diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2012-04-29 19:56:49 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2012-04-29 19:56:49 (GMT) |
commit | 2420d831582a5403d679b6383933112948d476fe (patch) | |
tree | a7c62c90314436f1442457f484bd25508d92fad8 /Lib/imaplib.py | |
parent | ea7e9f9a83a88325e599d0a7b31122e50495a5aa (diff) | |
download | cpython-2420d831582a5403d679b6383933112948d476fe.zip cpython-2420d831582a5403d679b6383933112948d476fe.tar.gz cpython-2420d831582a5403d679b6383933112948d476fe.tar.bz2 |
Issue #10941: Fix imaplib.Internaldate2tuple to produce correct result near
the DST transition. Patch by Joe Peterson.
Diffstat (limited to 'Lib/imaplib.py')
-rw-r--r-- | Lib/imaplib.py | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py index 1fcba21..c0334d8 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -22,7 +22,7 @@ Public functions: Internaldate2tuple __version__ = "2.58" -import binascii, errno, random, re, socket, subprocess, sys, time +import binascii, errno, random, re, socket, subprocess, sys, time, calendar try: import ssl @@ -1340,19 +1340,9 @@ def Internaldate2tuple(resp): zone = -zone tt = (year, mon, day, hour, min, sec, -1, -1, -1) + utc = calendar.timegm(tt) - zone - utc = time.mktime(tt) - - # Following is necessary because the time module has no 'mkgmtime'. - # 'mktime' assumes arg in local timezone, so adds timezone/altzone. - - lt = time.localtime(utc) - if time.daylight and lt[-1]: - zone = zone + time.altzone - else: - zone = zone + time.timezone - - return time.localtime(utc - zone) + return time.localtime(utc) |