mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #14653: email.utils.mktime_tz() no longer relies on system
mktime() when timezone offest is supplied.
This commit is contained in:
parent
9bd4bf2a3d
commit
e99d3a160c
3 changed files with 13 additions and 4 deletions
|
@ -13,7 +13,7 @@ __all__ = [
|
|||
'quote',
|
||||
]
|
||||
|
||||
import time
|
||||
import time, calendar
|
||||
|
||||
SPACE = ' '
|
||||
EMPTYSTRING = ''
|
||||
|
@ -150,13 +150,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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue