lkml.org 
[lkml]   [2020]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 1/3] lib/vsprintf: Print time64_t in human readable format
On Thu, Apr 16, 2020 at 11:32:19AM +0900, Sergey Senozhatsky wrote:
> On (20/04/15 20:00), Andy Shevchenko wrote:
> [..]
> > #include <linux/of.h>
> > #include <net/addrconf.h>
> > @@ -1819,6 +1820,29 @@ char *rtc_str(char *buf, char *end, const struct rtc_time *tm,
> > return buf;
> > }
> >
> > +static noinline_for_stack
> > +char *time64_str(char *buf, char *end, const time64_t time,
> > + struct printf_spec spec, const char *fmt)
> > +{
> > + struct rtc_time rtc_time;
> > + struct tm tm;
> > +
> > + time64_to_tm(time, 0, &tm);
> > +
> > + rtc_time.tm_sec = tm.tm_sec;
> > + rtc_time.tm_min = tm.tm_min;
> > + rtc_time.tm_hour = tm.tm_hour;
> > + rtc_time.tm_mday = tm.tm_mday;
> > + rtc_time.tm_mon = tm.tm_mon;
> > + rtc_time.tm_year = tm.tm_year;
> > + rtc_time.tm_wday = tm.tm_wday;
> > + rtc_time.tm_yday = tm.tm_yday;
> > +
> > + rtc_time.tm_isdst = 0;
>
> Here you convert time64_t (signed, we also have unsigned version - timeu64_t)
> to tm first and then convert tm to rtc_time. Will rtc_time64_to_tm() do the
> trick?

You missed v2 round. The RTC is configuration dependent and Alexandre in favour
of removing those from RTC completely by replacing with always enabled
time64_to_tm().

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2020-04-21 15:09    [W:0.061 / U:0.736 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site