leroycep / zig-tzif

TZif parsing for Zig
MIT License
8 stars 2 forks source link

Transition time UTC offset #5

Closed FObersteiner closed 9 months ago

FObersteiner commented 9 months ago

https://github.com/leroycep/zig-tzif/blob/e1467e5f6659fb9da719b8cec419128021c4cf30/tzif.zig#L677

IIUC, a UTC offset takes effect at the transition time, not after the transition time. So to get the UTC offset for a given Unix time (s), you are looking for the next transition time less or equal to given Unix time. In the test quoted above, the UTC offset seems to take effect after the transition time. However, Pacific/Honolulu did not experience LMT anymore at the first transition time, EX:

-2334101315 --> a second before the first transition: LMT
1896-01-13 11:59:59-10:31:26 -37886.0

-2334101314 --> at the transition
1896-01-13 12:01:26-10:30 -37800.0

-1157283000 --> next transition
1933-04-30 03:00:00-09:30 -34200.0
...and so on
leroycep commented 9 months ago

Thanks for bringing this up! I've gone through and made sure that it returns the correct time now, at least with regards to transition times array.