<div dir="ltr"><div>A bit background, the TZ string actually came from the "stat":</div><div><br></div><div>$ ./toybox stat main.c<br> File: main.c<br> Size: 7673 Blocks: 16 IO Blocks: 512 regular file<br>Device: fe02h/65026d Inode: 3286769 Links: 1 Device type: 0,0<br>Access: (0644/-rw-r--r--) Uid: (502/fliu) Gid: (502/fliu)<br>Access: 2021-05-26 09:11:55.588533347 -0700<br>Modify: 2021-05-15 15:20:22.181927884 -0700<br>Change: 2021-05-15 15:20:22.181927884 -0700<br>$ ./toybox date -d "2021-05-15 15:20:22.181927884 -0700" +%s<br>date: bad date 2021-05-15 15:20:22.181927884 -0700</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 26, 2021 at 5:05 AM Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 5/26/21 6:52 AM, Rob Landley wrote:<br>
> Can I maybe just write to "extern long timezone" directly? (And always zero<br>
> "daylight"?) Posix sort of implies I can:<br>
> <br>
> <a href="https://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html" rel="noreferrer" target="_blank">https://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html</a><br>
<br>
Nope, because:<br>
<br>
DESCRIPTION<br>
The tzset() function initializes the tzname variable from the TZ envi‐<br>
ronment variable. This function is automatically called by the other<br>
time conversion functions that depend on the timezone.<br>
<br>
Which says if I modify the variables myself it'll just overwrite them every time<br>
it calls a function that would use them.<br>
<br>
I'm going to step away from the computer before I reimplement asctime() and<br>
strftime() from scratch in lib/lib.c. (Like the gnu date people apparently<br>
already did, meaning it can't possibly be the right thing to do.)<br>
<br>
Rob<br>
</blockquote></div>