libstdc++: Fix numeric save offset on Zone lines [PR124851]
Fixes a bug in libstdc++ that caused incorrect timezone offsets when Zone lines specified numeric DST save values.
This commit corrects how libstdc++ handles numeric save offsets in Zone lines within the timezone database. Previously, the standard offset was incorrectly stored in ZoneInfo::m_offset, ignoring the numeric save value. This resulted in incorrect timezone offsets being reported. The fix ensures that m_offset consistently stores only the standard offset, and the save value is added back when needed, resolving the inconsistency and providing accurate timezone information.
In Details
This commit addresses PR124851 by correcting the handling of numeric save offsets in ZoneInfo objects within src/c++20/tzdb.cc. The m_offset member was inconsistently storing either the standard offset or the total offset (standard + save), depending on the ZoneInfo constructor used. This commit standardizes m_offset to always store the standard offset and modifies the to() method to add the save value back when constructing the sys_info. The fix also includes a new test case testsuite/std/time/time_zone/numeric_save.cc.
For Context
The C++ standard library includes facilities for handling time zones. These time zones are defined by rules that specify how the offset from UTC changes throughout the year, including adjustments for daylight saving time (DST). These rules are stored in a database. When a time zone definition includes a numeric value for DST, this commit fixes a bug where that value was not correctly applied, leading to incorrect time conversions. This ensures that the correct offset is used when converting between times in different time zones.