public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/114279] New: utc_clock does not support leap seconds
@ 2024-03-08  6:51 gnaggnoyil at gmail dot com
  2024-03-08  7:59 ` [Bug libstdc++/114279] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gnaggnoyil at gmail dot com @ 2024-03-08  6:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114279

            Bug ID: 114279
           Summary: utc_clock does not support leap seconds
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gnaggnoyil at gmail dot com
  Target Milestone: ---

When using current GCC trunk, the program

#include <chrono>
#include <sstream>
#include <iostream>

int main(){
        std::stringstream stream;
        stream << "20161231-23:59:60.035";
        std::chrono::utc_time<std::chrono::milliseconds> utc_tp;
        (void)std::chrono::from_stream(stream, "%4Y%2m%2d-%2H:%2M:%S", utc_tp);
        std::cout << utc_tp << std::endl;
        return 0;
}

gives the following output:

2017-01-01 00:00:00.035

which does not seems to give leap seconds into consideration.

The current standard working draft [time.clock.utc.overview]#1 states

In contrast to sys_time, which does not take leap seconds into account,
utc_clock and its associated time_point, utc_time, count time, including leap
seconds, since 1970-01-01 00:00:00 UTC.

So I think the current libstdc++ implementation here is not conforming the
standard.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-09  0:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-08  6:51 [Bug libstdc++/114279] New: utc_clock does not support leap seconds gnaggnoyil at gmail dot com
2024-03-08  7:59 ` [Bug libstdc++/114279] " redi at gcc dot gnu.org
2024-03-08 11:21 ` redi at gcc dot gnu.org
2024-03-09  0:29 ` cvs-commit at gcc dot gnu.org
2024-03-09  0:31 ` redi at gcc dot gnu.org

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).