[Toybox] Stat %Z - What are valid values?

enh enh at google.com
Fri Dec 30 14:01:45 PST 2016


On Fri, Dec 30, 2016 at 1:51 PM, Rob Landley <rob at landley.net> wrote:
> On 12/30/2016 01:39 PM, enh wrote:
>> 1928-04-26 17:31:55.746667836 18446744072394174731
>
> Really we can partially blame posix here for not specifying whether
> time_t is signed or unsigned. (If it's unsigned it can't represent times
> before January 1, 1970, as the code on the left is doing. And there
> _are_ times before then. So I think we have to treat it as signed and go
> "32 bit timestamps gotta go away before 2038".)

if you want to be amused/horrified, you should look at the tzcode
stuff. iirc they only recently agreed that time_t is an integral type.

> Linus' opinion on unsigned time_t is here (spoiler: it's "no"):
>
>   https://lkml.org/lkml/2011/8/31/246
>
>> two patches attached.
> ...
>> the other
>> removes void* casts unnecessary since POSIX 2008 and fixes the
>> strftime buffer length argument.
>
> Why did you remove the comment block in the second patch? (Is it wrong?)

yes. that's what the second patch is --- it switches to using the
identifier the code should have used, which the comment claimed
doesn't exist. (and which indeed didn't exist until POSIX 2008.)

i guess "unnecessary" was a bit misleading: it's more "these casts are
unnecessary if you use the name of the `struct timespec` rather than
the name of the `time_t` inside the `struct timespec`".

(there's also the "-128" change in the same patch, but that's
unrelated and if i were less lazy i'd have sent that as a third
patch.)

> Rob



-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.


More information about the Toybox mailing list