diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2012-06-22 00:48:23 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2012-06-22 00:48:23 (GMT) |
commit | 76935b9c8cc083f4d00bee3b8f0c76054dd31013 (patch) | |
tree | 98f6ece8d6a3a7d582c76b209c1c943719fc3db0 /Lib/email | |
parent | 2180c97a0055c8c2f6f2cf0754bfb650d7cc0f34 (diff) | |
parent | a07548e97bd819884ed1ddcfedb0fcbcbfdc58fe (diff) | |
download | cpython-76935b9c8cc083f4d00bee3b8f0c76054dd31013.zip cpython-76935b9c8cc083f4d00bee3b8f0c76054dd31013.tar.gz cpython-76935b9c8cc083f4d00bee3b8f0c76054dd31013.tar.bz2 |
Issue #14653: email.utils.mktime_tz() no longer relies on system
mktime() when timezone offest is supplied.
Diffstat (limited to 'Lib/email')
-rw-r--r-- | Lib/email/_parseaddr.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py index 0342469..3528d02 100644 --- a/Lib/email/_parseaddr.py +++ b/Lib/email/_parseaddr.py @@ -13,7 +13,7 @@ __all__ = [ 'quote', ] -import time +import time, calendar SPACE = ' ' EMPTYSTRING = '' @@ -177,13 +177,13 @@ def parsedate(data): def mktime_tz(data): - """Turn a 10-tuple as returned by parsedate_tz() into a UTC timestamp.""" + """Turn a 10-tuple as returned by parsedate_tz() into a POSIX timestamp.""" if data[9] is None: # No zone info, so localtime is better assumption than GMT return time.mktime(data[:8] + (-1,)) else: - t = time.mktime(data[:8] + (0,)) - return t - data[9] - time.timezone + t = calendar.timegm(data) + return t - data[9] def quote(str): |