From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 510F13858CD1; Mon, 8 Apr 2024 20:48:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 510F13858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712609289; bh=10JwltH00cR5fjNeU4jEyY2Z+9l+ZqzmoOo3+aQl5l4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EecX9Fg1vO5xvHCo+z6hakEoa+7LSZX1jcOek0F5Ugm3E3MzmVelzKB3LfLLdoN20 QBd8V0zUhDyXV39gqAQ2Am9f2peCouZwOkMUbYQ1iZ1fR6qWKj5weWKY8XlxCa2V+X 0f2zKmvELuafP42N/0PvdX5pa0Eb59DtV2oQA3Zk= 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: Mon, 08 Apr 2024 20:48:09 +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: UNCONFIRMED X-Bugzilla-Resolution: 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 #5 from Jonathan Wakely --- The libc time zone doesn't necessarily correspond to anything in the IANA database anyway. If you use a POSIX time zone definition like TZ=3D"abc4abd= " then libc will use that to generate a custom time zone and use that for localtim= e, ctime etc. That's not compatible with the std::chrono model, which uses the IANA zones= . So "the time zone libc would consider local" might not be a real time zone any= way. If you want to interpret $TZ then you can write code to do so, and convert = that into a name that std::chrono::locale_zone understands. So if TZ is an IANA name, use it directly, otherwise extract the offset part and then use somet= hing like "Etc/GMT-8".=