Files
gcc/libstdc++-v3
Jonathan Wakely fbc5d2b1ab libstdc++: Fix parsing of UNTIL times in tzdata.zi [PR124513]
Zone lines ending with a plain number as the time for the DST transition
(e.g. "2026 Mar 16 2") were incorrectly parsed as changing at midnight.
The problem was that eofbit got set after extracting the "2" from the
stream using `in >> i`, then the `in >> at.indicator` expression
failed and set failbit, so that the `if (in >> at.indicator)` condition
was always false and so the assignment to at.time guarded by that
condition was never performed. So the at.time member was always left
equal to zero, i.e. midnight. Suffixed times such as "2s" or "2u" were
parsed correctly.

This commit fixes the operator>> overload for the Indicator enum to not
cause failbit to be set if eofbit is already set. This means that the
`in >> at.indicator` expression yields true when converted to bool, and
the assignment to at.time happens. Not trying to extract an Indicator
when eofbit is already set is correct, because it's valid for there to
be no indicator suffix on an AT time (that just means the time should be
interpreted as wall time).

There was also a bug in the handling of a "-" value for the time, which
is supposed to mean midnight but was not being parsed due to failing to
skip leading whitespace. That did no harm in most cases, because the "-"
would not be extracted from the stream but would then cause a failure to
parse an integer number of hours, and no time would be set, causing it
to default to midnight, which is what "-" means anyway. However, a value
of "-u" is supposed to mean midnight UTC and "-s" is supposed to mean
midnight standard time, and the indicators for UTC or standard were not
being set in those cases. This fix uses std::ws to skip initial
whitespace, and then correctly handles "-" followed by EOF.

libstdc++-v3/ChangeLog:

	PR libstdc++/124513
	* src/c++20/tzdb.cc (operator>>(istream&, at_time::Indicator&)):
	Do not peek at the next character if eofbit is already set.
	(istream& operator>>(istream&, at_time&)): Skip whitespace
	before the first character. Handle EOF when parsing "-" as time.
	Do not peek for ":" or "." if eofbit already set.
	* testsuite/std/time/time_zone/116110.cc (test_apia): Remove
	offset of 24h now that the UNTIL time is parsed correctly.
	* testsuite/std/time/time_zone/124513.cc: New test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-03-19 11:44:01 +00:00
..
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2025-10-05 17:14:49 +01:00
2026-03-19 00:16:27 +00:00
2026-01-01 18:50:16 +01:00
2026-01-02 09:56:11 +01:00
2025-10-05 17:14:49 +01:00

file: libstdc++-v3/README

New users may wish to point their web browsers to the file
index.html in the 'doc/html' subdirectory.  It contains brief
building instructions and notes on how to configure the library in
interesting ways.