public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "howard.hinnant at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/114260] std::formatter<std::chrono::utc_time<std::chrono::days>> formats as the previous day Date: Thu, 07 Mar 2024 22:44:36 +0000 [thread overview] Message-ID: <bug-114260-4-I6vtuBdcmS@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-114260-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114260 --- Comment #2 from Howard Hinnant <howard.hinnant at gmail dot com> --- This: 2024-03-05 00:00:00 2024-03-04 23:59:33 looks like correct output to me. sys_time and utc_time map to the same civil calendar date/time (except during a leap second). That is 2024-03-05 00:00:00 sys_time, converted to utc_time, also should print out as 2024-03-05 00:00:00. The only difference between sys_time and utc_time is that utc_time counts the leap seconds since 1970 (27 at this point). This means if you look at the difference in .time_since_epoch(), utc_time will be 27 seconds longer, even though it prints out as the same date and time. Consequently, 2024-03-05 00:00:00 in utc_time is *not* a multiple of 86400s, but rather 27s greater than a multiple of 86400s. And all round<days>(udays) does is round the .time_since_epoch() to the nearest multiple of 86400s. Which in utc_time is 27s earlier, or 2024-03-04 23:59:33. So in summary, if you make a change, and *don't* get this output, then you've introduced a bug.
next prev parent reply other threads:[~2024-03-07 22:44 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-06 23:51 [Bug libstdc++/114260] New: " redi at gcc dot gnu.org 2024-03-07 8:18 ` [Bug libstdc++/114260] " redi at gcc dot gnu.org 2024-03-07 22:44 ` howard.hinnant at gmail dot com [this message] 2024-03-07 23:08 ` 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-114260-4-I6vtuBdcmS@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: linkBe 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).