lkml.org 
[lkml]   [2019]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v1 1/4] lib/vsprintf: Print time64_t in human readable format
On Tue, Oct 01, 2019 at 02:13:21PM +0200, Alexandre Belloni wrote:
> On 01/10/2019 15:11:54+0300, Andy Shevchenko wrote:
> > On Tue, Oct 01, 2019 at 01:48:16PM +0200, Alexandre Belloni wrote:
> > > On 01/10/2019 14:36:55+0300, Andy Shevchenko wrote:
> > > > On Mon, Sep 30, 2019 at 10:08:09PM +0200, Alexandre Belloni wrote:
> > > > > > > Maybe be rtc_str should take a struct tm instead of an rtc_time so
> > > > > > > time64_to_rtc_time always uses time64_to_tm.
> > > > > >
> > > > > > Because this one, while sounding plausible, maybe too invasive on current
> > > > > > state of affairs.
> > > > >
> > > > > Well, if the kernel struct tm had an int tm_year instead of long
> > > > > tm_year, then you could simply cast a struct rtc_time to a struct tm.
> > > >
> > > > I don't think so. It will be error prone from endianess prospective on
> > > > 64-bit platforms.
> > > >
> > >
> > > I don't get why, as long as the first members of both structs are the
> > > same, this should work.
> >
> > On BE 64-bit we will always get tm_year == 0, won't we?
> >
>
> Not if you have int tm_year in struct tm. I guess we can change the
> kernel struct tm because it is not part of the ABI.

We can, but:
- it will require to change all `printf("%ld", tm_year)` cases at the same
time in entire kernel (and also some functions might start producing
warnings when some variable will be cut to int)
- it is out of scope of this series

So, I will leave it untouched for now.

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2019-10-01 15:34    [W:0.050 / U:0.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site