aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/target-memory.cc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-09-04 21:23:20 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2024-09-06 21:44:47 +0100
commit222ff1949a70997173aefe2e32d144661473d86b (patch)
treec17ed17cda6131ed718052e33ca20463f166c88f /gcc/fortran/target-memory.cc
parent1fa45e77154732af147e87aee1779a3b10db2b7a (diff)
downloadgcc-222ff1949a70997173aefe2e32d144661473d86b.zip
gcc-222ff1949a70997173aefe2e32d144661473d86b.tar.gz
gcc-222ff1949a70997173aefe2e32d144661473d86b.tar.bz2
libstdc++: Fix std::chrono::parse for TAI and GPS clocks
Howard Hinnant brought to my attention that chrono::parse was giving incorrect values for chrono::gps_clock, because it was applying the offset between the GPS clock and UTC. That's incorrect, because when we parse HH::MM::SS as a GPS time, the result should be that time, not HH:MM:SS+offset. The problem was that I was using clock_cast to convert from sys_time to utc_time and then using clock_time again to convert to gps_time. The solution is to convert the parsed time into an duration representing the time since the GPS clock's epoch, then construct a gps_time directly from that duration. As well as adding tests for correct round tripping of times for all clocks, this also adds some more tests for correct results with std::format. libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (from_stream): Fix conversions in overloads for gps_time and tai_time. * testsuite/std/time/clock/file/io.cc: Test round tripping using chrono::parse. Add additional std::format tests. * testsuite/std/time/clock/gps/io.cc: Likewise. * testsuite/std/time/clock/local/io.cc: Likewise. * testsuite/std/time/clock/tai/io.cc: Likewise. * testsuite/std/time/clock/utc/io.cc: Likewise.
Diffstat (limited to 'gcc/fortran/target-memory.cc')
0 files changed, 0 insertions, 0 deletions