[issue22798] time.mktime doesn't update time.tzname
Akira Li
report at bugs.python.org
Mon Aug 31 18:47:59 CEST 2015
Akira Li added the comment:
The C code produces correct values according to the tz database.
If TZ=Europe/Moscow then
tzname={"MSK", "MSD"} at 2010-07-01 and
tzname={"MSK", "MSK"} at 2015-07-01. Notice the difference!
The code calls C mktime() with corresponding time tuples
and checks that *tzname* is equal to the expected values. That's all.
If C code is incomprehensible; here's its Python analog:
>>> import os
>>> os.environ['TZ'] = 'Europe/Moscow'
>>> import time
>>> time.tzset()
>>> time.mktime((2010,7,1,0,0,0,-1,-1,-1))
1277928000.0
>>> time.tzname #XXX expected ('MSK', 'MSD')
('MSK', 'MSK')
>>> time.mktime((2015,7,1,0,0,0,-1,-1,-1))
1435698000.0
>>> time.tzname
('MSK', 'MSK')
C tzname changes on my machine after the corresponding C mktime() calls
but Python time.tzname does not change after the time.mktime() calls.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22798>
_______________________________________
More information about the Python-bugs-list
mailing list