[Datetime-SIG] IANA TZ database statistics

Tim Peters tim.peters at gmail.com
Sat Sep 26 04:28:20 CEST 2015


>>> https://github.com/abalkin/cpython/commit/54d3596b0180512c68c91e8308665c0a9e61c9eb

[Tim]
>> Wondering whether this line:
>>
>>     if probe2 != result + trans:
>>
>> could be replaced with:
>>
>>     if probe2 == result:

[Alex]
> Yes, it can.   Thanks for the suggestion.

Good!  So you have a simple, cross-platform solution now, at least for
timestamps localtime() doesn't barf on.


> The only assumption that it requires is that no fold is bigger than 24 hours.

Well, it does rely on more than just that.  For example, if there's a
gap where the clock jumps from 2 to 3, followed soon after by a fold
of an hour repeating times of the form 4:MM, then the second
occurrence of 4:30 won't be detected as such.- the fold and the gap
"cancel out" with respect to subtracting 24 hours in either naive time
or timestamp time.

So it seems a sufficient condition is that there's at most one UTC
offset change in the last 24 hours.

I wouldn't be surprised if that's always true now - or that it won't
be after Kim Jong-un learns he could annoy us by making it false ;-)


More information about the Datetime-SIG mailing list