[Datetime-SIG] Implementing tzinfo for all valid datetimes (was Re: PEP-431/495)

Stuart Bishop stuart at stuartbishop.net
Mon Aug 24 17:54:30 CEST 2015


On 24 August 2015 at 14:05, Tim Peters <tim.peters at gmail.com> wrote:
> [Tim]
>> Oops!  Somewhere around 2037-2038 it apparently lost all knowledge of
>> US/Eastern daylight time.  I expect this is why:
>>
>>     >>> ez._utc_transition_times[-1]
>>     datetime.datetime(2037, 11, 1, 6, 0)
>>
>> That is, the last transition it knows about is the end of daylight time in 2037.
> ...
>>
>> Digging deeper, I don't think I can pin this on tzfile.  The docs say
>> that, if possible, a tzfile also contains a POSIX-TZ-style rule to be
>> used for times beyond the last explicit transition instant.  In the
>> US/Eastern tzfile shipped with this version of pytz, that's:
>>
>>     EST5EDT,M3.2.0,M11.1.0
>>
>> So a "complete" wrapping of zoneinfo also requires implementing such
>> rules when present.

Yeah, I should really do that before 2037...


> This appears to be the scoop, although I may be wrong about some:
> when tzfile was first invented, like most other stuff at the time it
> assumed the world would end before 2038 (the first year a signed
> 32-bit int is too narrow to hold a UNIX(tm) seconds-since-1970
> timestamp).  Values in a tzfile were all at most 4 bytes, zic
> generated all transitions explicitly through the end of 2037, and that
> was that.

Not that the world would end. Just that we would be safely retired :)


-- 
Stuart Bishop <stuart at stuartbishop.net>
http://www.stuartbishop.net/


More information about the Datetime-SIG mailing list