This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: mktime_tz may return wrong result for past dates before Python 2.7.4
Type: behavior Stage:
Components: email Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: akira, barry, r.david.murray
Priority: normal Keywords:

Created on 2014-04-16 20:00 by akira, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg216572 - (view) Author: Akira Li (akira) * Date: 2014-04-16 20:00
>>> from email.utils import mktime_tz, parsedate_tz
>>> mktime_tz(parsedate_tz('Thu, 1 Jan 1970 00:00:00 GMT'))
3600.0

It must returns `0` instead of `3600.0` assuming POSIX timestamp.

UTC offsets in 1970 and today are different from each other by one hour in my local timezone (`time.mktime(1970, ..)` uses one UTC offset and `time.timezone` another). There are around a hundred such timezones.

Note: `time.timezone == time.altzone` in my local timezone i.e., it can't be the documented DST issue.

The bug is present in Python 2.6.9 (the last 2.6 release). 
The bug is present in Python 2.7.3 (Ubuntu 12.04 LTS supported until 2017)

It is fixed in Python 2.7.4+ while replacing `time.mktime` with `calendar.timegm` in issue 14653.
msg217737 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-05-02 01:28
Since you say the bug is fixed, what do you intend the purpose of this issue to be?
msg217738 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-05-02 01:29
Oh, I missed the fact that you had closed it.
History
Date User Action Args
2022-04-11 14:58:02adminsetgithub: 65466
2014-05-02 01:29:27r.david.murraysetmessages: + msg217738
2014-05-02 01:28:11r.david.murraysetmessages: + msg217737
2014-04-16 20:00:27akirasetstatus: open -> closed
resolution: fixed
2014-04-16 20:00:03akiracreate