https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116110
Bug ID: 116110
Summary: Transitions obtained from chrono::time_zone::get_info
should not treat times as UTC
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
#include <chrono>
#include <print>
int main()
{
using namespace std::chrono;
sys_days date(2014y/December/21);
auto zone = locate_zone("Asia/Bishkek");
auto info = zone->get_info(date);
zoned_time local(zone, info.begin);
std::println("{}: {}", zone->name(), local);
}
This prints:
Asia/Bishkek: 2005-08-12 06:00:00 +06
But the transition should be at midnight local time, not midnight UTC.
I noted this in the source:
// XXX The ri.until() time point should be
// "interpreted using the rules in effect just before the transition"
info.end = ri.until();
// XXX UNTIL field should be interpreted
// "using the rules in effect just before the transition"
// so might need to store as year_month_day and hh_mm_ss and only
// convert to a sys_time once we know the offset in effect.
inf.m_until = sys_days(year(y)/m.m/day(d)) + seconds(t.time);