diff Lib/email/_parseaddr.py @ 77560:ffc048f43a70 3.2

Issue #14653: email.utils.mktime_tz() no longer relies on system mktime() when timezone offest is supplied.
author Alexander Belopolsky <alexander.belopolsky@gmail.com>
date Thu, 21 Jun 2012 20:34:09 -0400
parents 27fe09ff14b7
children 9f88c38318ac
line wrap: on
line diff
--- a/Lib/email/_parseaddr.py	Thu Jun 21 20:20:25 2012 +0200
+++ b/Lib/email/_parseaddr.py	Thu Jun 21 20:34:09 2012 -0400
@@ -13,7 +13,7 @@
     'quote',
     ]
 
-import time
+import time, calendar
 
 SPACE = ' '
 EMPTYSTRING = ''
@@ -152,13 +152,13 @@
 
 
 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):