From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 902873858C5F; Thu, 7 Mar 2024 00:10:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 902873858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709770226; bh=ZXEgxwBMG9LOgMpF4Ht2sJU5jsqLS0wp0vgMCAKhnus=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lP3t1etFPKlnJQ7uLQJGt9XBvV/bO9Lco9z4hh9WErfAXilRs4DjvLw2JAOvDeXyK 4rzWnPP0CZ03FOfLIi8a/fa/i9yGPAEFnd3aWYgD2PsUKotO8t/FKi5QdXuBlaY04Q gfg3cUmfOK92Hlq7PSNTTk7GAZG1LT+z98XrIBLA= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/114240] sys_days not being parsed with only a date in the stream Date: Thu, 07 Mar 2024 00:10:26 +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: --- 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=3D114240 --- Comment #5 from Jonathan Wakely --- > using __format::_ChronoParts; > auto __need =3D _ChronoParts::_Year | _ChronoParts::_Month > - | _ChronoParts::_Day | _ChronoParts::_TimeOfDay; > + | _ChronoParts::_Day; > + if constexpr (ratio_less_v) > + __need |=3D _ChronoParts::_TimeOfDay; This condition's not right. If we have a period of days, but a floating-point rep, we probably do want = to parse and use a time if one is present in the input. "2024-03-07 00:05" can= be represented by sys_time> and is not the same time as "2024-03-07". And if we have a period like ratio then it's greater than days, but not using the time of day in the result will lose accuracy. I'm leaning towards Howard's approach of just assuming 00:00:00 if no time = is present, rather than making it depend on the period in any way.=