Alexander Belopolsky <[email protected]> added the comment:
Let's establish what is the correct wall clock sequence around EDT to EST
transition:
>>> import time
>>> def print_time(s):
... tt = time.localtime(s)
... print(time.strftime('%c %z %Z', tt))
x = datetime(2010, 11, 7, 5)
>>> s = (x - datetime(1970, 1, 1))//timedelta(seconds=1)
>>> for i in range(-3600, 5000, 1200):
... print_time(s + i)
...
Sun Nov 7 00:00:00 2010 -0400 EDT
Sun Nov 7 00:20:00 2010 -0400 EDT
Sun Nov 7 00:40:00 2010 -0400 EDT
Sun Nov 7 01:00:00 2010 -0400 EDT
Sun Nov 7 01:20:00 2010 -0400 EDT
Sun Nov 7 01:40:00 2010 -0400 EDT
Sun Nov 7 01:00:00 2010 -0500 EST
Sun Nov 7 01:20:00 2010 -0500 EST
However, neither Local nor Eastern tzinfo instance is capable of reproducing
this sequence:
>>> for i in range(-3600, 5000, 1200):
... print(datetime.fromtimestamp(s + i, Eastern).strftime('%c %z %Z'))
Sun Nov 7 00:00:00 2010 -0400 EDT
Sun Nov 7 00:20:00 2010 -0400 EDT
Sun Nov 7 00:40:00 2010 -0400 EDT
Sun Nov 7 01:00:00 2010 -0500 EST
Sun Nov 7 01:20:00 2010 -0500 EST
Sun Nov 7 01:40:00 2010 -0500 EST
Sun Nov 7 01:00:00 2010 -0500 EST
Sun Nov 7 01:20:00 2010 -0500 EST
>>> for i in range(-3600, 5000, 1200):
... print(datetime.fromtimestamp(s + i, Local).strftime('%c %z %Z'))
Sun Nov 7 00:00:00 2010 -0400 EDT
Sun Nov 7 00:20:00 2010 -0400 EDT
Sun Nov 7 00:40:00 2010 -0400 EDT
Sun Nov 7 01:00:00 2010 -0400 EDT
Sun Nov 7 01:20:00 2010 -0400 EDT
Sun Nov 7 01:40:00 2010 -0400 EDT
Sun Nov 7 02:00:00 2010 -0500 EST
Sun Nov 7 02:20:00 2010 -0500 EST
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue9063>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com