[tz] Wrong behaviour with truncated TZif files

Almaz Mingaleev mingaleev at google.com
Thu Feb 17 13:09:04 UTC 2022


Hi Paul,
I've built TZif files with following commands:
mkdir /tmp/zic
cd /tmp/zic
git clone https://github.com/eggert/tz.git .
make -C . zic
make -C . NDATA= rearguard.zi
mkdir data
# Truncate at 1 Jan 2100.
./zic -b fat -r "/@4102444800" -d ./data rearguard.zi
make TZDIR="./data" all

Then I've compiled attached file:
g++ mktime_test.cpp localtime.o

Test tries to find epoch timestamp for 2 Jul 1980 midnight at
America/Los_Angeles.

With a truncated TZif file it prints 331344000. With non-truncated one it
prints 331372800.
The latter is the right answer.

Also, date command is wrong on certain time zones:
make TZDIR="./data" date
TZ=Antarctica/Palmer ./date -r -631152000

prints "Sat Dec 31 20:00:00 -04 1949" even though 1 Jan 1950 offset should
be zero
<https://github.com/eggert/tz/blob/df4699ddfc9caf6f875f1e38703dd0ef41826175/southamerica#L1350>
.

Thanks,
Almaz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mm.icann.org/pipermail/tz/attachments/20220217/b9213c98/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mktime_test.cpp
Type: application/octet-stream
Size: 278 bytes
Desc: not available
URL: <https://mm.icann.org/pipermail/tz/attachments/20220217/b9213c98/mktime_test.cpp>


More information about the tz mailing list