summaryrefslogtreecommitdiffstats
path: root/Lib/datetime.py
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2012-06-22 20:04:19 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2012-06-22 20:04:19 (GMT)
commit93c9cd07b62371b99f712e41c7bec71dad1c86ec (patch)
treed5520f9b0be4534110efc60ffb5379a74fedc3ad /Lib/datetime.py
parent5f6213be2d5890d7bc3ba62db58ac1ce0215aaaa (diff)
downloadcpython-93c9cd07b62371b99f712e41c7bec71dad1c86ec.zip
cpython-93c9cd07b62371b99f712e41c7bec71dad1c86ec.tar.gz
cpython-93c9cd07b62371b99f712e41c7bec71dad1c86ec.tar.bz2
Issue #9527: tm_gmtoff has 'correct' sign.
Diffstat (limited to 'Lib/datetime.py')
-rw-r--r--Lib/datetime.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/datetime.py b/Lib/datetime.py
index e4d7161..a15c6b0 100644
--- a/Lib/datetime.py
+++ b/Lib/datetime.py
@@ -1510,13 +1510,13 @@ class datetime(date):
# implied by tm_isdst.
delta = local - datetime(*_time.gmtime(ts)[:6])
dst = _time.daylight and localtm.tm_isdst > 0
- gmtoff = _time.altzone if dst else _time.timezone
- if delta == timedelta(seconds=-gmtoff):
+ gmtoff = -(_time.altzone if dst else _time.timezone)
+ if delta == timedelta(seconds=gmtoff):
tz = timezone(delta, _time.tzname[dst])
else:
tz = timezone(delta)
else:
- tz = timezone(timedelta(seconds=-gmtoff), zone)
+ tz = timezone(timedelta(seconds=gmtoff), zone)
elif not isinstance(tz, tzinfo):
raise TypeError("tz argument must be an instance of tzinfo")