[issue19502] Wrong time zone offset, when using time.strftime() with a given struct_time

Alexander Belopolsky report at bugs.python.org
Tue Nov 5 16:25:54 CET 2013


Alexander Belopolsky added the comment:

I cannot reproduce this and I suspect that the problem shows up only in certain times.

I believe this is related to the long-standing issue that was fixed in 3.3.  See issue 1667546.  In Python prior to 3.3, time_struct did not store timezone information:

Python 2.7.5 (default, Aug 13 2013, 01:04:43)
>>> import time
>>> time.localtime().tm_zone
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'time.struct_time' object has no attribute 'tm_zone'

Python 3.3.2 (default, Aug 13 2013, 00:57:00)
>>> import time
>>> time.localtime().tm_zone
'EST'

Since this cannot be fixed without backporting new features, I don't think we can fix this in 2.7 or 3.2.  Those affected by this problem should upgrade to 3.3.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19502>
_______________________________________


More information about the Python-bugs-list mailing list