1414
1515from string import digits
1616import time
17+ import calendar
1718import os
1819
1920__all__ = ('get_object_type_by_name' ,'parse_date' ,'parse_actor_and_date' ,
@@ -106,9 +107,10 @@ def parse_date(string_date):
106107 * ISO 8601 2005-04-07T22:13:13
107108 The T can be a space as well
108109
109- :return: Tuple(int(timestamp ), int(offset)), both in seconds since epoch
110+ :return: Tuple(int(timestamp_UTC ), int(offset)), both in seconds since epoch
110111 :raise ValueError: If the format could not be understood
111- :note: Date can also be YYYY.MM.DD, MM/DD/YYYY and DD.MM.YYYY"""
112+ :note: Date can also be YYYY.MM.DD, MM/DD/YYYY and DD.MM.YYYY.
113+ """
112114# git time
113115try :
114116if string_date .count (' ' )== 1 and string_date .rfind (':' )== - 1 :
@@ -121,6 +123,7 @@ def parse_date(string_date):
121123offset = verify_utctz (string_date [- 5 :])
122124string_date = string_date [:- 6 ]# skip space as well
123125# END split timezone info
126+ offset = utctz_to_altz (offset )
124127
125128# now figure out the date and time portion - split time
126129date_formats = list ()
@@ -153,10 +156,10 @@ def parse_date(string_date):
153156for fmt in date_formats :
154157try :
155158dtstruct = time .strptime (date_part ,fmt )
156- fstruct = time . struct_time ((dtstruct .tm_year ,dtstruct .tm_mon ,dtstruct .tm_mday ,
159+ utctime = calendar . timegm ((dtstruct .tm_year ,dtstruct .tm_mon ,dtstruct .tm_mday ,
157160tstruct .tm_hour ,tstruct .tm_min ,tstruct .tm_sec ,
158161dtstruct .tm_wday ,dtstruct .tm_yday ,tstruct .tm_isdst ))
159- return int (time . mktime ( fstruct )), utctz_to_altz ( offset )
162+ return int (utctime ), offset
160163except ValueError :
161164continue
162165# END exception handling