summaryrefslogtreecommitdiffstats
path: root/Lib/_strptime.py
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2012-06-14 02:15:26 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2012-06-14 02:15:26 (GMT)
commitc142bba2a7ead80b99aef44b3dca06e2a4be4923 (patch)
tree9ead9517a479f4d9634014fd3d1f34e8b37cc9b5 /Lib/_strptime.py
parentf6a899fe6d39b5447abc5966a3dfe386b9d6656e (diff)
downloadcpython-c142bba2a7ead80b99aef44b3dca06e2a4be4923.zip
cpython-c142bba2a7ead80b99aef44b3dca06e2a4be4923.tar.gz
cpython-c142bba2a7ead80b99aef44b3dca06e2a4be4923.tar.bz2
Issue #1667546: On platforms supporting tm_zone and tm_gmtoff fields
in struct tm, time.struct_time objects returned by time.gmtime(), time.localtime() and time.strptime() functions now have tm_zone and tm_gmtoff attributes. Original patch by Paul Boddie.
Diffstat (limited to 'Lib/_strptime.py')
-rw-r--r--Lib/_strptime.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/_strptime.py b/Lib/_strptime.py
index fa06376..b0cd3d6 100644
--- a/Lib/_strptime.py
+++ b/Lib/_strptime.py
@@ -486,19 +486,19 @@ def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
return (year, month, day,
hour, minute, second,
- weekday, julian, tz, gmtoff, tzname), fraction
+ weekday, julian, tz, tzname, gmtoff), fraction
def _strptime_time(data_string, format="%a %b %d %H:%M:%S %Y"):
"""Return a time struct based on the input string and the
format string."""
tt = _strptime(data_string, format)[0]
- return time.struct_time(tt[:9])
+ return time.struct_time(tt[:time._STRUCT_TM_ITEMS])
def _strptime_datetime(cls, data_string, format="%a %b %d %H:%M:%S %Y"):
"""Return a class cls instance based on the input string and the
format string."""
tt, fraction = _strptime(data_string, format)
- gmtoff, tzname = tt[-2:]
+ tzname, gmtoff = tt[-2:]
args = tt[:6] + (fraction,)
if gmtoff is not None:
tzdelta = datetime_timedelta(seconds=gmtoff)