locatime() and TZ
Lehner Georg <[email protected]> Fri, 4 Jan 2019 11:38:39 +0100
| Newsgroups | gmane.linux.lib.dietlibc |
|---|---|
| Organization | MagmaSoft |
| Message-ID | <[email protected]> |
Hello,
localtime(), according to POSIX, can be tricked into converting time to
any timezone via the TZ environment variable by virtue of tzset().
dietlibc tzset() does not take into account the environment variable, it
just reads /etc/localtime.
Two usecase referring to tai64nlocal from Dan Bernstein:
- set TZ="" (or TZ=UTC or TZ=GMT) to compare logfile entry timestamps
across the globe.
- set TZ to a customers timezone, to compare logfile entry timestamps to
time indications by them ("Email bounced at 9 o'clock)
Is the current dietlibc tzset() behaviour by intention or is it just a
missing feature?
Best Regards and a Happy New Year,
Georg
- - -
Reference:
- TZ variable:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
Note that behaviour of empty TZ is not specified (allowed?). Common
practice seems to interpret it as GMT.
- tzset():
http://pubs.opengroup.org/onlinepubs/9699919799/functions/tzset.html
--
Georg Lehner
MagmaSoft Internet Services
http://magma-soft.at/
mailto:[email protected]