Message108470
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 |
|
Date |
User |
Action |
Args |
2010-06-23 18:29:51 | belopolsky | set | recipients:
+ belopolsky, docs@python |
2010-06-23 18:29:51 | belopolsky | set | messageid: <1277317791.39.0.255972459527.issue9063@psf.upfronthosting.co.za> |
2010-06-23 18:29:49 | belopolsky | link | issue9063 messages |
2010-06-23 18:29:49 | belopolsky | create | |
|