[Toybox] date with timezone

Rob Landley rob at landley.net
Wed May 26 05:21:49 PDT 2021


On 5/26/21 6:52 AM, Rob Landley wrote:
> Can I maybe just write to "extern long timezone" directly? (And always zero
> "daylight"?) Posix sort of implies I can:
> 
>   https://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html

Nope, because:

DESCRIPTION
       The tzset() function initializes the tzname variable from the TZ  envi‐
       ronment  variable.   This function is automatically called by the other
       time conversion functions that depend on the timezone.

Which says if I modify the variables myself it'll just overwrite them every time
it calls a function that would use them.

I'm going to step away from the computer before I reimplement asctime() and
strftime() from scratch in lib/lib.c. (Like the gnu date people apparently
already did, meaning it can't possibly be the right thing to do.)

Rob



More information about the Toybox mailing list