summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2016-03-25 19:42:59 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2016-03-25 19:42:59 (GMT)
commit1dcf4f9ee5b60f23291a377353b3dceca7cc9dc9 (patch)
tree12df3e33f597e65096dbe0e532e3c88517928f36 /Modules
parent84ca9fe14533d7fca2cf5c18d3cba3e72c8204ae (diff)
downloadcpython-1dcf4f9ee5b60f23291a377353b3dceca7cc9dc9.zip
cpython-1dcf4f9ee5b60f23291a377353b3dceca7cc9dc9.tar.gz
cpython-1dcf4f9ee5b60f23291a377353b3dceca7cc9dc9.tar.bz2
Issue#26616:Fixed a bug in datetime.astimezone() method.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_datetimemodule.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index e3de537..0e50023 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -4749,7 +4749,12 @@ local_timezone(PyDateTime_DateTime *utc_time)
PyObject *nameo = NULL;
const char *zone = NULL;
- delta = datetime_subtract((PyObject *)utc_time, PyDateTime_Epoch);
+ delta = new_delta(ymd_to_ord(GET_YEAR(utc_time), GET_MONTH(utc_time),
+ GET_DAY(utc_time)) - 719163,
+ 60 * (60 * DATE_GET_HOUR(utc_time) +
+ DATE_GET_MINUTE(utc_time)) +
+ DATE_GET_SECOND(utc_time),
+ 0, 0);
if (delta == NULL)
return NULL;
one_second = new_delta(0, 1, 0, 0);