[Datetime-SIG] IANA TZ database statistics

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Sep 24 00:44:26 CEST 2015


On Wed, Sep 23, 2015 at 6:16 PM, Chris Angelico <rosuav at gmail.com> wrote:

> A lot of the small numbers are going to be when different places
> adopted standard time, and such. To get a better handle on what's
> happening _now_, I added an option [1] to your stats function for a
> starting year:
>
> >>> ZoneInfo.stats(start_year=1970)
> Number of zones:  1790 = 46266 (gaps) + 46130 (folds) + 843 (zeros)
> Min gap:                  0:15:00 at 1985-12-31 18:30:13 in
> right/Asia/Kathmandu
> Max gap:           1 day, 0:00:00 at 2011-12-30 10:00:24 in
> right/Pacific/Apia
> Min fold:                 0:30:00 at 2037-04-04 15:00:26
> in right/Australia/Lord_Howe
> Max fold:                 3:00:00 at 2012-02-21 17:00:24
> in right/Antarctica/Casey
> >>> ZoneInfo.stats()
> Number of zones:  1790 = 58914 (gaps) + 58777 (folds) + 1363 (zeros)
> Min gap:                  0:00:16 at 1935-01-01 03:40:52 in
> posix/America/Paramaribo
> Max gap:           1 day, 0:00:00 at 2011-12-30 10:00:24 in
> right/Pacific/Apia
> Min fold:                 0:01:31 at 1932-01-01 03:58:29 in
> posix/America/Barbados
> Max fold:                10:00:00 at 1952-01-13 14:00:00 in
> posix/Antarctica/DumontDUrville
>

It looks like you've got double counts because you included both "posix"
and "right" tzfiles in the search.  (I don't think the data that I actually
read is different between the two sets.)


> I'm not sure whether this actually helps anything or not, but hey, cool
> stats :)
>

If we can make some simplified assumptions about transition locations and
sizes, we can avoid a binary search over seconds to locate the transitions
via POSIX localtime/mktime APIs.

I am considering making the cut-off at 1970 and assume 1970 standard time
for all times before that year.  I think this is best we can do on Windows
where (IIRC) mktime does not work for times before epoch.  (What about
localtime?)

In any case, TZ data before 1970 is highly suspect so we will probably do
our users a favor by assuming standard time and letting those with
historical timeseries figure out the transitions by themselves.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20150923/1bb0d0b8/attachment.html>


More information about the Datetime-SIG mailing list