[issue14653] Improve mktime_tz to use calendar.timegm instead of time.mktime
Jakub Wilk added the comment: The documentations says Minor deficiency: mktime_tz() interprets the first 8 elements of tuple as a local time and then compensates for the timezone difference. This may yield a slight error around changes in daylight savings time, though not worth worrying about for common use. Now that this bug has been fixed, this no longer true. Please update the documentation. :) -- nosy: +jwilk ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14653] Improve mktime_tz to use calendar.timegm instead of time.mktime
R. David Murray added the comment: Since this issue has been closed, it would be great if you'd open a new issue just for the doc change. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14653] Improve mktime_tz to use calendar.timegm instead of time.mktime
Jakub Wilk added the comment: Fair enough, filed as issue #18243. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14653] Improve mktime_tz to use calendar.timegm instead of time.mktime
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset ffc048f43a70 by Alexander Belopolsky in branch '3.2': Issue #14653: email.utils.mktime_tz() no longer relies on system http://hg.python.org/cpython/rev/ffc048f43a70 New changeset 9f88c38318ac by Alexander Belopolsky in branch 'default': Issue #14653: email.utils.mktime_tz() no longer relies on system http://hg.python.org/cpython/rev/9f88c38318ac -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14653] Improve mktime_tz to use calendar.timegm instead of time.mktime
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset a283563c8cc4 by Alexander Belopolsky in branch '2.7': Issue #14653: email.utils.mktime_tz() no longer relies on system http://hg.python.org/cpython/rev/a283563c8cc4 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14653] Improve mktime_tz to use calendar.timegm instead of time.mktime
Changes by Alexander Belopolsky alexander.belopol...@gmail.com: -- resolution: - fixed stage: commit review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14653] Improve mktime_tz to use calendar.timegm instead of time.mktime
Alexander Belopolsky alexander.belopol...@gmail.com added the comment: That said, this might be a worthwhile as a bug fix. I think this is a reasonable bug fix. Note that apart from OS-dependent date range, some mktime implementations reportedly don't support tm_isdst values other than -1. -- assignee: - belopolsky stage: - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14653] Improve mktime_tz to use calendar.timegm instead of time.mktime
Changes by R. David Murray rdmur...@bitdance.com: -- assignee: r.david.murray - components: +email -Library (Lib) nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14653] Improve mktime_tz to use calendar.timegm instead of time.mktime
Changes by Martin Panter vadmium...@gmail.com: -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14653] Improve mktime_tz to use calendar.timegm instead of time.mktime
R. David Murray rdmur...@bitdance.com added the comment: I think that what is going to happen is that both of these functions are going to be deprecated in favor of functions that use datetimes. That said, this might be a worthwhile as a bug fix. I'm adding Alexander as nosy to see what he thinks. (mktime_tz is located in email.utils, with the source in Lib/email/_parseaddr.py). -- assignee: - r.david.murray nosy: +belopolsky, r.david.murray versions: +Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14653] Improve mktime_tz to use calendar.timegm instead of time.mktime
New submission from Mitar mmi...@gmail.com: I would suggest improvement of mktime_tz to use calendar.timegm internally instead of time.mktime. The problem is that on Windows mktime_tz fails with mktime argument out of range for this code: mktime_tz(parsedate_tz('Thu, 1 Jan 1970 00:00:00 GMT')) if user is in GMT+X timezone. Obviously, Thu, 1 Jan 1970 00:00:00 GMT is not out of range. But because mktime_tz uses internally time.mktime which takes into the account local time (and local timezone) and then compensate for the timeline, out of range condition happens. I would suggest such implementation: def mktime_tz(data): Turn a 10-tuple as returned by parsedate_tz() into a UTC timestamp. if data[9] is None: # No zone info, so localtime is better assumption than GMT return time.mktime(data[:8] + (-1,)) else: t = calendar.timegm(data[:8] + (0,)) return t - data[9] It does not raise and exception, and it is also much cleaner: directly using GMT function and not localtime with timezone compensation. -- components: Library (Lib) messages: 159074 nosy: mitar priority: normal severity: normal status: open title: Improve mktime_tz to use calendar.timegm instead of time.mktime type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com