public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hristo at venev dot name" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/114645] std::chrono::current_zone ignores $TZ on Linux Date: Tue, 09 Apr 2024 09:41:29 +0000 [thread overview] Message-ID: <bug-114645-4-uPDHafMhFh@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-114645-4@http.gcc.gnu.org/bugzilla/> 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.
next prev parent reply other threads:[~2024-04-09 9:41 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-08 19:01 [Bug libstdc++/114645] New: " hristo at venev dot name 2024-04-08 19:27 ` [Bug libstdc++/114645] " redi at gcc dot gnu.org 2024-04-08 20:23 ` hristo at venev dot name 2024-04-08 20:25 ` redi at gcc dot gnu.org 2024-04-08 20:46 ` hristo at venev dot name 2024-04-08 20:48 ` redi at gcc dot gnu.org 2024-04-08 20:51 ` redi at gcc dot gnu.org 2024-04-08 20:56 ` hristo at venev dot name 2024-04-09 9:19 ` redi at gcc dot gnu.org 2024-04-09 9:41 ` hristo at venev dot name [this message] 2024-04-09 9:46 ` xry111 at gcc dot gnu.org 2024-04-09 9:49 ` hristo at venev dot name 2024-04-09 16:40 ` redi at gcc dot gnu.org 2024-04-09 17:19 ` hristo at venev dot name 2024-04-09 23:29 ` harald at gigawatt dot nl 2024-04-09 23:29 ` redi at gcc dot gnu.org 2024-04-09 23:43 ` redi at gcc dot gnu.org 2024-04-09 23:47 ` redi at gcc dot gnu.org 2024-04-09 23:50 ` harald at gigawatt dot nl 2024-04-09 23:57 ` redi at gcc dot gnu.org 2024-04-10 0:07 ` redi at gcc dot gnu.org 2024-04-10 0:26 ` harald at gigawatt dot nl 2024-04-10 0:57 ` redi at gcc dot gnu.org 2024-04-10 1:10 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-114645-4-uPDHafMhFh@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).