homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients belopolsky, docs@python
Date 2010年06月23日.18:29:48
SpamBayes Score 0.006489981
Marked as misclassified No
Message-id <1277317791.39.0.255972459527.issue9063@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2010年06月23日 18:29:51belopolskysetrecipients: + belopolsky, docs@python
2010年06月23日 18:29:51belopolskysetmessageid: <1277317791.39.0.255972459527.issue9063@psf.upfronthosting.co.za>
2010年06月23日 18:29:49belopolskylinkissue9063 messages
2010年06月23日 18:29:49belopolskycreate

AltStyle によって変換されたページ (->オリジナル) /