diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2016-03-25 15:42:59 -0400 |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2016-03-25 15:42:59 -0400 |
commit | 4a570a7b8a14db38813500e24ed316e22221ed81 (patch) | |
tree | da2b60b574b794374fb8ca9a9e990b224102e2eb /Modules | |
parent | f3efba6269c21707a5c893f5ef70519f2ce868da (diff) | |
download | cpython-4a570a7b8a14db38813500e24ed316e22221ed81.tar.gz |
Issue#26616:Fixed a bug in datetime.astimezone() method.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_datetimemodule.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index e3de537a8d..0e50023eea 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); |