Open apavenis opened 8 months ago
PS: We are trying to use a wrapper around std::chrono and date libraries to preserve earlier used API as much as possible to make conversion of large software project (about 3000000 lines) as easy as possible.
This is a great plan. Many people don't realize how useful chrono can be as middleware like this.
It appears you are using the time zone database that ships with your OS (USE_OS_TZDB=1
), and this is fine. However one drawback of this is that this database strips out the save
value and replaces it with a single bit: 1 == (save != 0min)
and 0 == (save == 0min)
. This is most unfortunate. However the offset
is still accurate: 3h vs 2h. So you can still get accurate conversions between local_time and sys_time.
My recommendation is to ignore the save
value, except to answer the question of "is this DST or not".
Another workaround would be to interpret 1min as 1h. However that approach is incorrect with some timezones. So I don't recommend it unless you know a-priori that you are dealing with a subset of timezones where the delta between standard and dst is always 1h.
I specified to date::zoned_time objects (one with DST and another without) and printed following:
Sys_info::save value in the second sample (DST on) is clearly incorrect 00:01:00, when it should be 01:00:00
PS: We are trying to use a wrapper around std::chrono and date libraries to preserve earlier used API as much as possible to make conversion of large software project (about 3000000 lines) as easy as possible.