diff options
author | Mark de Wever <koraq@xs4all.nl> | 2024-04-23 22:28:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-23 22:28:31 +0200 |
commit | 4e9decf294a19d0047da3aada980f24d19d6c62c (patch) | |
tree | f8f61fd6a6cf63a8aae8274b2602954100391f36 /libcxx/src | |
parent | 837dab96d6f5bece79fd58d28ea2e6f7c0912493 (diff) | |
download | llvm-4e9decf294a19d0047da3aada980f24d19d6c62c.zip llvm-4e9decf294a19d0047da3aada980f24d19d6c62c.tar.gz llvm-4e9decf294a19d0047da3aada980f24d19d6c62c.tar.bz2 |
[libc++][TZDB] Fixes reverse time lookups. (#89502)
Testing with the get_info() returning a local_info revealed some issues
in the reverse lookup. This needed an additional quirk. Also the
skipping when not in the current continuation optimization was wrong. It
prevented merging two sys_info objects.
Diffstat (limited to 'libcxx/src')
-rw-r--r-- | libcxx/src/time_zone.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libcxx/src/time_zone.cpp b/libcxx/src/time_zone.cpp index aef6ac6..928f3d2 100644 --- a/libcxx/src/time_zone.cpp +++ b/libcxx/src/time_zone.cpp @@ -567,11 +567,22 @@ __first_rule(seconds __stdoff, const vector<__tz::__rule>& __rules) { false}; } - __named_rule_until __continuation_end{__continuation}; - if (__time >= __continuation_end.__until() && !__continuation_end.__needs_adjustment()) - // note std::unexpected<sys_seconds>(__end); is ambiguous with std::unexpected() in <exception>, - return __sys_info_result{std::unexpect, __continuation_end.__until()}; + if (__rule->__save.__time != 0s) { + // another fix for America/Punta_Arenas when not at the start of the + // sys_info object. + seconds __save = __rule->__save.__time; + if (__continuation_begin >= __rule_begin - __save && __time < __next.first) { + return __sys_info{ + sys_info{__continuation_begin, + __next.first, + __continuation.__stdoff + __save, + chrono::duration_cast<minutes>(__save), + chrono::__format(__continuation, __rule->__letters, __save)}, + false}; + } + } + __named_rule_until __continuation_end{__continuation}; while (__next.second != __rules.end()) { #ifdef PRINT std::print( |