[Toybox] Stat %Z - What are valid values?
Rich Felker
dalias at libc.org
Sat Jan 21 16:25:36 PST 2017
On Sat, Jan 21, 2017 at 03:18:28PM -0600, Rob Landley wrote:
> > Or if it's signed, that's -1346458162 which would be... sometime in the
> > 1930's? hmmm... "./date -D %s -d -1346458162" is failing under glibc,
> > and failing _differently_ under musl. (Wheee.)
> >
> > /me goes down tangent rathole debugging why.
> ....
> >
> > (Answer: musl doesn't implement %s at all, and glibc doesn't allow the
> > %s value it converts to be negative.)
>
> Query: does bionic strptime() handle %s, and if so does it handle
> negative input values? (If not I suppose I can try to special case this
> in toybox, but ew.)
>
> Also, Rich: any interest in adding this to musl?
strptime with %s? I suspect there are some nasty underspecified issues
with how it interacts with timezones. All the standard specifiers work
with broken-down (struct tm) time so timezone is irrelevant to how
they operate.
So the answer isn't no, but "it's complicated", and needs more
research on how other implementations work, if they're consistent,
pros and cons of different possible behaviors, etc.
Rich
More information about the Toybox
mailing list