From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 36EA93858C39; Tue, 9 Apr 2024 09:41:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 36EA93858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712655692; bh=/7iEe6TUxbl0t5nQhJ29jBsEtmdeXZ1hpw2pj7cwGzk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wX+QNrNDHJwQWc4HLLUaX+KIe6ux3PVmPcyPCaETP1A0fbS9PQ9kKdu1VpqK3zmNZ mwUcqV/EoLlLyMJyytvEoiyQkXVu7AJo3JRMNPvjk9TEmfNOVBAV1A45QGeJk6MC7N diWS5X7LsvEJPPzOS+lUwW9RoJbgZtaCaRw+BuxU= From: "hristo at venev dot name" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hristo at venev dot name X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: WONTFIX X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114645 --- Comment #9 from Hristo Venev --- I stumbled upon this comment in the library you linked: https://github.com/HowardHinnant/date/blob/0e65940a7fbc4ed617a1ee111a60311e= ccbead9a/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 m= atch the platform's "local time" as closely as reasonably possible. The implementation also has some comments: https://github.com/HowardHinnant/date/blob/0e65940a7fbc4ed617a1ee111a60311e= ccbead9a/src/tz.cpp#L3936 The intent seems to be clear -- apply a lot of heuristics to try to match w= hat libc would do as closely as possible. Even on Linux there are no guarantees whatsoever that it is possible to ext= ract a IANA time zone from /etc/localtime. In fact, the problem is exactly ident= ical 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 direct= ory is a IANA time zone name.=