libstdc++: Add C++20 clocks
authorJonathan Wakely <jwakely@redhat.com>
Thu, 7 Oct 2021 16:37:07 +0000 (17:37 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Sun, 13 Nov 2022 01:10:45 +0000 (01:10 +0000)
commit1736bf5a61c7364c5da6fa52e5e2bfdbc9507c97
treee5ad071c8af7a4684bd2c2734affe49027bfbe8c
parent1d9454aba615eadd0d85c93713dd848227345f67
libstdc++: Add C++20 clocks

Also add the basic types for timezones, without the non-inline
definitions needed to actually use them.

The get_leap_second_info function currently uses a hardcoded list of
leap seconds, correct as of the end of 2022. That needs to be replaced
with a dynamically generated list read from the system tzdata. That will
be done in a later patch.

libstdc++-v3/ChangeLog:

* include/std/chrono (utc_clock, tai_clock, gps_clock): Define.
(clock_time_conversion, clock_cast): Define.
(sys_info, local_info): Define structs for timezone information.
(nonexistent_local_time, ambiguous_local_time): Define
exceptions for invalid times.
(time_zone, time_zone_link, leap_second, zoned_traits, tzdb)
(tzdb_list): Define classes representing time zones.
(get_leap_second_info): Define new function returning leap
second offset for a given time point.
* testsuite/std/time/clock/gps/1.cc: New test.
* testsuite/std/time/clock/tai/1.cc: New test.
* testsuite/std/time/clock/utc/1.cc: New test.
libstdc++-v3/include/std/chrono
libstdc++-v3/testsuite/std/time/clock/gps/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/std/time/clock/tai/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/std/time/clock/utc/1.cc [new file with mode: 0644]