HowardHinnant / date

A date and time library based on the C++11/14/17 <chrono> header
Other
3.17k stars 685 forks source link

Parsing zone files generated with zic -b slim makes data be bogus #614

Open LarsGullik opened 4 years ago

LarsGullik commented 4 years ago

iana-tzdb changed the default for zic from -b fat to -b slim in 2020b. This seems to trigger some problems with the tzif parser.

In particular the begin/end info in sys_info is not correct anymore:

auto sys = sys_days(2020_y/April/26_d);
auto * europe_oslo = locate_zone("Europe/Oslo");
auto sys_info = europe_oslo->get_info(sys);
ASSERT_EQUALS(sys_days{2020_y/March/29_d} + 1h, sys_info.begin);

Fails with: expected: 2020-03-29 01:00:00
actual: 1996-03-31 01:00:00

HowardHinnant commented 4 years ago

Thanks for the report. The binary db reader is going to need an overhaul to accommodate slim. Do you know if any platform is actually shipping slim?

LarsGullik commented 4 years ago

On Mon, 26 Oct 2020 at 00:20, Howard Hinnant notifications@github.com wrote:

Thanks for the report. The binary db reader is going to need an overhaul to accommodate slim. Do you know if any platform is actually shipping slim?

I am not aware of any, except for the one that we make ourselves. We are changing to explicit '-b fat' to work around this issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HowardHinnant/date/issues/614#issuecomment-716229590, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADXUFODYOYZRM43LYCDOLZ3SMSXCXANCNFSM4S6UC4AQ .

-- Lgb

LarsGullik commented 4 years ago

A google search shows me that some projects that have their own copy of the zoneinfo files are already switching to using the slim format.

charno commented 3 years ago

zic has changed it's standard behavour. From the Changelog (https://data.iana.org/time-zones/releases/tzcode2021d.tar.gz, file NEWS)

Release 2020b - 2020-10-06 18:35:04 -0700
[...]
zic now defaults to '-b slim' instead of to '-b fat'.
joemarshall commented 5 months ago

@HowardHinnant We've hit this bug in Apache Arrow also. On emscripten / webassembly python, we don't have embedded tzdata so we use the tzdata package as a source for zone files. The python tzdata package uses -b slim format now; so timezone handling breaks in arrow.