https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114645

--- Comment #9 from Hristo Venev <hristo at venev dot name> ---
I stumbled upon this comment in the library you linked:

https://github.com/HowardHinnant/date/blob/0e65940a7fbc4ed617a1ee111a60311eccbead9a/include/date/tz.h#L35

That comment is wrong in its explanation of the mechanism used to determine the
local time zone on Linux. However, it clearly shows that the intent is to match
the platform's "local time" as closely as reasonably possible.

The implementation also has some comments:

https://github.com/HowardHinnant/date/blob/0e65940a7fbc4ed617a1ee111a60311eccbead9a/src/tz.cpp#L3936

The intent seems to be clear -- apply a lot of heuristics to try to match what
libc would do as closely as possible.

Even on Linux there are no guarantees whatsoever that it is possible to extract
a IANA time zone from /etc/localtime. In fact, the problem is exactly identical
to that with $TZ, if not worse -- $TZ is normally an IANA time zone name,
whereas /etc/localtime is a symlink (but sometimes a hardlink or a copy) of a
file in some OS-specific directory  (sometimes, but not always,
/usr/share/zoneinfo) where the name of the file relative to the base directory
is a IANA time zone name.

Reply via email to