summaryrefslogtreecommitdiffstats
path: root/Modules
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 /Modules
parent5f6213be2d5890d7bc3ba62db58ac1ce0215aaaa (diff)
downloadcpython-93c9cd07b62371b99f712e41c7bec71dad1c86ec.zip
cpython-93c9cd07b62371b99f712e41c7bec71dad1c86ec.tar.gz
cpython-93c9cd07b62371b99f712e41c7bec71dad1c86ec.tar.bz2
Issue #9527: tm_gmtoff has 'correct' sign.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_datetimemodule.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 149f573..6df5c03 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -4717,12 +4717,8 @@ local_timezone(PyDateTime_DateTime *utc_time)
return NULL;
timep = localtime(&timestamp);
#ifdef HAVE_STRUCT_TM_TM_ZONE
- {
- long offset;
- offset = timep->tm_gmtoff;
- zone = timep->tm_zone;
- delta = new_delta(0, -offset, 0, 0);
- }
+ zone = timep->tm_zone;
+ delta = new_delta(0, timep->tm_gmtoff, 0, 1);
#else /* HAVE_STRUCT_TM_TM_ZONE */
{
PyObject *local_time;
@@ -4732,7 +4728,7 @@ local_timezone(PyDateTime_DateTime *utc_time)
utc_time->tzinfo);
if (local_time == NULL)
goto error;
- delta = datetime_subtract((PyObject*)utc_time, local_time);
+ delta = datetime_subtract(local_time, (PyObject*)utc_time);
/* XXX: before relying on tzname, we should compare delta
to the offset implied by timezone/altzone */
if (daylight && timep->tm_isdst >= 0)