From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 04CAA3858002; Thu, 7 Mar 2024 22:44:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 04CAA3858002 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709851478; bh=52BGUgrr3eBGgBK9wxDsFWZv6Jc9M7O+2tpZvi72pf8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RakTcwOlXsMcaa8xzPkDGQrZfQxKUIaDeFBEoXc8tScMV5dUzK3TvPub4rfge+9J7 5ISam8ITeMs9CZQmQqggLmoo4EMXS/KrO51BMB09DvkoHD6lfUv+o+4KVzfPF4ojIP tm6pDxQoyuTqrw3YH+qHY4HdoQ3/T0iouMsHMsUE= From: "howard.hinnant at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/114260] std::formatter> formats as the previous day Date: Thu, 07 Mar 2024 22:44:36 +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: howard.hinnant at gmail dot com 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=3D114260 --- Comment #2 from Howard Hinnant --- 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 duri= ng 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 t= he 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(uday= s) does is round the .time_since_epoch() to the nearest multiple of 86400s. W= hich 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.=