From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 783D03858C31; Fri, 8 Mar 2024 11:21:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 783D03858C31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709896912; bh=VoMel+86muk5dYg54e8a7V8tfczoUxbX4kSFLAeGiB4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZiEmD8U4FPTs5+0TdRLU7BhUYiwzE5LSbCcRxVkYBeJWEyvXmb7sWxVlq1lckZ/0l j230/11QBC4eu7fUkmBHVZsFlyLoFeTE7U2G0rLi1YIX1Ah8yLVHaKjcDn8hCpUA5s tBYAp5ud5a1ZtfW3C/mkekWFD0qKVP8BJzvGcdbM= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/114279] utc_clock does not support leap seconds Date: Fri, 08 Mar 2024 11:21:52 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: target_milestone assigned_to everconfirmed cf_reconfirmed_on bug_status 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=3D114279 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |13.3 Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu= .org Ever confirmed|0 |1 Last reconfirmed| |2024-03-08 Status|UNCONFIRMED |ASSIGNED --- Comment #2 from Jonathan Wakely --- Fix: --- a/libstdc++-v3/include/bits/chrono_io.h +++ b/libstdc++-v3/include/bits/chrono_io.h @@ -2854,9 +2854,19 @@ namespace __detail basic_string<_CharT, _Traits, _Alloc>* __abbrev =3D nullptr, minutes* __offset =3D nullptr) { - sys_time<_Duration> __st; - if (chrono::from_stream(__is, __fmt, __st, __abbrev, __offset)) - __tp =3D chrono::time_point_cast<_Duration>(utc_clock::from_sys(__s= t)); + minutes __off{}; + if (!__offset) + __offset =3D &__off; + using __format::_ChronoParts; + auto __need =3D _ChronoParts::_Year | _ChronoParts::_Month + | _ChronoParts::_Day | _ChronoParts::_TimeOfDay; + __detail::_Parser_t<_Duration> __p(__need); + if (__p(__is, __fmt, __abbrev, __offset)) + { + auto __ut =3D utc_clock::from_sys(__p._M_sys_days) + __p._M_time + - *__offset; + __tp =3D chrono::time_point_cast<_Duration>(__ut); + } return __is; } But we also need a change to the other from_stream overloads that are defin= ed in terms of utc_time, so that they don't allow 60s.=