public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.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 [thread overview]
Message-ID: <bug-114240-4-yZnD4n1uXc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114240-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114240
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> using __format::_ChronoParts;
> auto __need = _ChronoParts::_Year | _ChronoParts::_Month
> - | _ChronoParts::_Day | _ChronoParts::_TimeOfDay;
> + | _ChronoParts::_Day;
> + if constexpr (ratio_less_v<typename _Duration::period, days::period>)
> + __need |= _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<duration<double, days::period>> and is not the same
time as "2024-03-07".
And if we have a period like ratio<days::period::num+1, 1> 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.
next prev parent reply other threads:[~2024-03-07 0:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-05 15:11 [Bug libstdc++/114240] New: " howard.hinnant at gmail dot com
2024-03-05 15:21 ` [Bug libstdc++/114240] " redi at gcc dot gnu.org
2024-03-05 15:25 ` redi at gcc dot gnu.org
2024-03-05 15:31 ` howard.hinnant at gmail dot com
2024-03-05 15:53 ` redi at gcc dot gnu.org
2024-03-06 21:28 ` redi at gcc dot gnu.org
2024-03-07 0:10 ` redi at gcc dot gnu.org [this message]
2024-03-08 10:45 ` redi at gcc dot gnu.org
2024-03-09 0:29 ` cvs-commit at gcc dot gnu.org
2024-03-09 0:33 ` redi at gcc dot gnu.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-114240-4-yZnD4n1uXc@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).