diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2023-02-28 21:07:48 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2023-03-01 21:26:08 +0000 |
commit | 4abd5bc600193e821fbc41995a0b8d9ea42b42c3 (patch) | |
tree | 63d094ee9628e23e341c9f7c07a748d52b136b3e /gcc | |
parent | 096f034a8f5df41f610e62c1592fb90a3f551cd5 (diff) | |
download | gcc-4abd5bc600193e821fbc41995a0b8d9ea42b42c3.zip gcc-4abd5bc600193e821fbc41995a0b8d9ea42b42c3.tar.gz gcc-4abd5bc600193e821fbc41995a0b8d9ea42b42c3.tar.bz2 |
libstdc++: Make std::chrono::current_zone() default to UTC
This is consistent with the behaviour of glibc, which assumes UTC when
/etc/localtime and TZ do not identify a valid time zone. The fallback
tzdb used when no valid tzdata exists always contains the UTC zone, so
this change means we have a valid tzdb and valid current zone even in
the degenerate case.
With this default we no longer need the AIX-specific kluge to try and
identify TZ values specifying a 0-offset zone. We can just use the UTC
default for those, as it has the same effect.
It's still possible for chrono::current_zone() to fail, because the user
could have provided a custom tzdata.zi file which doesn't contain the
UTC time zone, so the "UTC" default would fail to find a valid zone, and
throw an exception. That's just user error, they should not provide bad
data and expect reasonable behaviour.
libstdc++-v3/ChangeLog:
* src/c++20/tzdb.cc (chrono::tzdb::current_zone()) Use "UTC" if
current time zone cannot be determined.
* testsuite/std/time/tzdb/1.cc: Remove conditions based on
HAVE_TZDB macro and test all members unconditionally.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions