From 93c9cd07b62371b99f712e41c7bec71dad1c86ec Mon Sep 17 00:00:00 2001 From: Alexander Belopolsky Date: Fri, 22 Jun 2012 16:04:19 -0400 Subject: Issue #9527: tm_gmtoff has 'correct' sign. --- Lib/datetime.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Lib/datetime.py') diff --git a/Lib/datetime.py b/Lib/datetime.py index e4d716198f..a15c6b0919 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") -- cgit v1.2.1