Neatify the _timezones table and remove a misleading comment about
inaccuracies in mktime_tz().
This commit is contained in:
parent
3130b7a2a9
commit
67133e25a2
|
@ -632,11 +632,11 @@ _daynames = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
||||||
# instead of timezone names.
|
# instead of timezone names.
|
||||||
|
|
||||||
_timezones = {'UT':0, 'UTC':0, 'GMT':0, 'Z':0,
|
_timezones = {'UT':0, 'UTC':0, 'GMT':0, 'Z':0,
|
||||||
'AST': -400, 'ADT': -300, # Atlantic standard
|
'AST': -400, 'ADT': -300, # Atlantic (used in Canada)
|
||||||
'EST': -500, 'EDT': -400, # Eastern
|
'EST': -500, 'EDT': -400, # Eastern
|
||||||
'CST': -600, 'CDT':-500, # Centreal
|
'CST': -600, 'CDT': -500, # Central
|
||||||
'MST':-700, 'MDT':-600, # Mountain
|
'MST': -700, 'MDT': -600, # Mountain
|
||||||
'PST':-800, 'PDT':-700 # Pacific
|
'PST': -800, 'PDT': -700 # Pacific
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -713,14 +713,7 @@ def parsedate(data):
|
||||||
|
|
||||||
|
|
||||||
def mktime_tz(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 UTC timestamp."""
|
||||||
|
|
||||||
Minor glitch: this first interprets the first 8 elements as a
|
|
||||||
local time and then compensates for the timezone difference;
|
|
||||||
this may yield a slight error around daylight savings time
|
|
||||||
switch dates. Not enough to worry about for common use.
|
|
||||||
|
|
||||||
"""
|
|
||||||
if data[9] is None:
|
if data[9] is None:
|
||||||
# No zone info, so localtime is better assumption than GMT
|
# No zone info, so localtime is better assumption than GMT
|
||||||
return time.mktime(data[:8] + (-1,))
|
return time.mktime(data[:8] + (-1,))
|
||||||
|
|
Loading…
Reference in New Issue