[issue9798] time.tzset() doesn't properly reset the time.timezone variable

Peter Simons report at bugs.python.org
Wed Sep 8 14:41:36 CEST 2010


New submission from Peter Simons <simons at cryp.to>:

Attached are two programs that I would expect to produce the same output, but they don't.

$ python --version
Python 2.6.5

$ cat test-timezone-1.py 
import os, time

os.environ["TZ"] = "Europe/Berlin"
time.tzset()
print "time.timezone =", time.timezone

os.environ["TZ"] = "Egypt"
time.tzset()
print "time.timezone =", time.timezone

$ cat test-timezone-2.py 
import os
from time import tzset, timezone

os.environ["TZ"] = "Europe/Berlin"
tzset()
print "timezone =", timezone

os.environ["TZ"] = "Egypt"
tzset()
print "timezone =", timezone

$ python test-timezone-1.py 
time.timezone = -3600
time.timezone = -7200

$ python test-timezone-2.py 
timezone = -3600
timezone = -3600

----------
components: Library (Lib)
messages: 115864
nosy: simons
priority: normal
severity: normal
status: open
title: time.tzset() doesn't properly reset the time.timezone variable
type: behavior
versions: Python 2.6

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


More information about the Python-bugs-list mailing list