Fix timezone handling of b338a2370.

This commit is contained in:
Valentin Lorentz 2015-08-22 20:38:16 +02:00
parent 73ed9635b5
commit 39df987274
2 changed files with 2 additions and 2 deletions

View File

@ -152,7 +152,7 @@ class IrcMsg(object):
if 'time' in self.server_tags: if 'time' in self.server_tags:
s = self.server_tags['time'] s = self.server_tags['time']
date = datetime.datetime.strptime(s, '%Y-%m-%dT%H:%M:%S.%fZ') date = datetime.datetime.strptime(s, '%Y-%m-%dT%H:%M:%S.%fZ')
print(repr(date)) date = date.replace(tzinfo=datetime.timezone.utc)
self.time = date.timestamp() self.time = date.timestamp()
else: else:
self.time = time.time() self.time = time.time()

View File

@ -155,7 +155,7 @@ class IrcMsgTestCase(SupyTestCase):
msg = ircmsgs.IrcMsg('@time=2011-10-19T16:40:51.620Z ' msg = ircmsgs.IrcMsg('@time=2011-10-19T16:40:51.620Z '
':Angel!angel@example.org PRIVMSG Wiz :Hello') ':Angel!angel@example.org PRIVMSG Wiz :Hello')
self.assertEqual(msg.time, 1319035251.62) self.assertEqual(msg.time, 1319042451.62)
class FunctionsTestCase(SupyTestCase): class FunctionsTestCase(SupyTestCase):
def testIsAction(self): def testIsAction(self):