handle milliseconds in time result stanza. Fixes #5905
This commit is contained in:
parent
896fe73945
commit
cfac956598
|
@ -152,12 +152,16 @@ class TimeResultReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
|
|||
|
||||
try:
|
||||
t = datetime.datetime.strptime(utc_time, '%Y-%m-%dT%H:%M:%SZ')
|
||||
t = t.replace(tzinfo=UTC())
|
||||
self.time_info = t.astimezone(contact_tz()).strftime('%c')
|
||||
except ValueError, e:
|
||||
log.info('Wrong time format: %s' % str(e))
|
||||
return
|
||||
try:
|
||||
t = datetime.datetime.strptime(utc_time,
|
||||
'%Y-%m-%dT%H:%M:%S.%fZ')
|
||||
except ValueError, e:
|
||||
log.info('Wrong time format: %s' % str(e))
|
||||
return
|
||||
|
||||
t = t.replace(tzinfo=UTC())
|
||||
self.time_info = t.astimezone(contact_tz()).strftime('%c')
|
||||
return True
|
||||
|
||||
class GMailQueryReceivedEvent(nec.NetworkIncomingEvent):
|
||||
|
|
Loading…
Reference in New Issue