Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1661535

Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human readable format via %pt

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human readable format via %pt
Date 2017-06-08 20:00 +0200
Message-ID <tQ9SV-7ln-9@gated-at.bofh.it> (permalink)
References <tQ5Z1-4WL-35@gated-at.bofh.it> <tQ5Z1-4WL-37@gated-at.bofh.it> <tQ6V4-5vT-19@gated-at.bofh.it> <tQ74K-5AT-7@gated-at.bofh.it> <tQ7eq-5TV-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jun 8, 2017 at 6:05 PM, Alexandre Belloni
<alexandre.belloni@free-electrons.com> wrote:
> On 08/06/2017 at 17:55:12 +0300, Andy Shevchenko wrote:
>> On Thu, Jun 8, 2017 at 5:49 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> > On Thu, Jun 8, 2017 at 3:47 PM, Andy Shevchenko
>> > <andriy.shevchenko@linux.intel.com> wrote:
>> >> There are users which print time and date represented by content of
>> >> struct rtc_time in human readable format.
>> >>
>> >> Instead of open coding that each time introduce %pt[dt][rv] specifier.
>> >
>> > I really like the idea, and the implementation seems fine for this use case, but
>> > before we reserve %pt for rtc_time, could we discuss whether we want
>> > that for printing struct tm, struct timespec64, time64_t or ktime_t instead?
>>
>> How many users? For struct tm it's somelike 4 (which want to print its content).
>>
>> > I can see good reasons for pretty-printing any of them, but the namespace for
>> > format strings is rather limited.
>> >
>> > struct rtc_time is almost the same as struct tm (the former has one extra
>> > member), so maybe we can actually define them to be the same and
>> > use one format string for both?
>>
>> The reason I decide to drop struct tm for now due to they are not
>> compatible and I have got an interesting bugs.
>> Verify tm_year member carefully.
>>
>
> I understand this may not fit your debugging needs but what about pretty
> printing time64_t and using rtc_tm_to_time64?

There are two downsides as I can see:
1) conversion to and from just for that;
2) if you look closer to the patches rtc-* you may find cases where
wday is also printed so, struct rtc_time still will be in use.

So, I would go not to  convert if there is no strong reason to do.

-- 
With Best Regards,
Andy Shevchenko

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v1 04/25] lib/vsprintf: Print time and date in human readable format via %pt Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-06-08 15:50 +0200
  Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human  readable format via %pt Arnd Bergmann <arnd@arndb.de> - 2017-06-08 16:50 +0200
    Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human  readable format via %pt Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-08 17:00 +0200
      Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human  readable format via %pt Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-06-08 17:10 +0200
        Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human  readable format via %pt Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-08 20:00 +0200
          Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human  readable format via %pt Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-08 20:50 +0200
            Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human readable format via %pt Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2017-06-08 22:50 +0200
              Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human  readable format via %pt Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-08 23:30 +0200
                Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human  readable format via %pt Arnd Bergmann <arnd@arndb.de> - 2017-06-08 23:50 +0200
          Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human  readable format via %pt Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-06-08 20:50 +0200
      Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human  readable format via %pt Arnd Bergmann <arnd@arndb.de> - 2017-06-08 17:40 +0200
        Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human  readable format via %pt Joe Perches <joe@perches.com> - 2017-06-08 17:50 +0200
        Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human  readable format via %pt Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-08 20:10 +0200
          Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human  readable format via %pt Joe Perches <joe@perches.com> - 2017-06-09 01:10 +0200

csiph-web