[tz] zoneinfo vs zoneinfo-leaps

Bradley White bww at acm.org
Tue Nov 17 04:07:05 UTC 2015


On Mon, Nov 16, 2015 at 3:48 PM, Ken Murchison <murch at andrew.cmu.edu> wrote:

> Maybe this is a FAQ but I haven't found the answer.
>
> Having studied up the tzfile(5) format and written some code to produce
> these files, I'm wondering why the files in zoneinfo-leaps include the leap
> records AND adjust the transition times by the appropriate number of leap
> seconds.  This seems redundant to me.  If the file includes the leap second
> records, why not let the consumer adjust the transitions?


Because even after you have found the prevailing offset using the adjusted
transition times you still need to break down the resultant "local" seconds
count into the YMDhms fields, and that is most easily done using an
86400-seconds-per-day value.  That is, it helps to undo the adjustment.

You also need the leap records to determine the magnitude of the tm_sec
field during leaps (see the "hit" variable, which probably shouldn't be a
bool BTW).

Finally, the leap records are also used to implement the time2posix() and
posix2time() functions for translating to/from Posix timestamps.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mm.icann.org/pipermail/tz/attachments/20151116/ca207461/attachment.html>


More information about the tz mailing list