[drtv] Allow fractional timestamps (Fixes #4059)
This commit is contained in:
parent
50c8266ef0
commit
6ad4013d40
3 changed files with 5 additions and 7 deletions
|
@ -925,7 +925,7 @@ def parse_iso8601(date_str, delimiter='T'):
|
|||
return None
|
||||
|
||||
m = re.search(
|
||||
r'Z$| ?(?P<sign>\+|-)(?P<hours>[0-9]{2}):?(?P<minutes>[0-9]{2})$',
|
||||
r'(\.[0-9]+)?(?:Z$| ?(?P<sign>\+|-)(?P<hours>[0-9]{2}):?(?P<minutes>[0-9]{2})$)',
|
||||
date_str)
|
||||
if not m:
|
||||
timezone = datetime.timedelta()
|
||||
|
@ -938,7 +938,7 @@ def parse_iso8601(date_str, delimiter='T'):
|
|||
timezone = datetime.timedelta(
|
||||
hours=sign * int(m.group('hours')),
|
||||
minutes=sign * int(m.group('minutes')))
|
||||
date_format = '%Y-%m-%d{0}%H:%M:%S'.format(delimiter)
|
||||
date_format = '%Y-%m-%d{0}%H:%M:%S'.format(delimiter)
|
||||
dt = datetime.datetime.strptime(date_str, date_format) - timezone
|
||||
return calendar.timegm(dt.timetuple())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue