From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0CB82385840D; Tue, 9 Apr 2024 09:19:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0CB82385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712654383; bh=8q9w+jmr1/mFrklRAfjPcEd96UeQn8EjtcaUZ3JKaVU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=L2zzs49RFZUrscaM5KgBxtXp5yPA7erVdu6gn374W4OiQTgaMKAyrw2SGMA0nR0Ow 4KWR/m6NMOCUeaJmtcskO0RofdUNAPNKvP0Ofn3AorVrYeNFoHtoswzGB98I2PFcrM PXsqDJGEuclASKeLJswamTHsR/psQk/ETKxpq8V0= From: "redi at gcc dot 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:19:38 +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: redi at gcc dot gnu.org 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 #8 from Jonathan Wakely --- Yes, if an application assumes that chrono::current_zone matches $TZ, that'= s a bug in the application. None of libstdc++, LLVM libc++, MSVC STL or the date/tz.h reference implementation uses $TZ for chrono::current_zone, and I don't see how we could do so without breaking the guarantee that locate_zone(current_zone()->name()) works. The lifetime and ownership of the pointer returned by current_zone would also be unclear if it didn't return = one of the IANA zones owned by a tzdb object. The C++ library is extensible outside of namespace std, for exampl= e: https://github.com/HowardHinnant/date/blob/master/include/date/ptz.h (that uses the types and constants from the date namespace defined in date/= tz.h but that can be replaced by namespace date { using namespace std::chrono; }) We could provide something similar as an extension, but it wouldn't be used automatically by chrono::current_zone, because POSIX time zones (as used by libc) are not IANA zones.=