From 2644d1bc02a7a459f87b6f2a8ec1a4b910bc1078 Mon Sep 17 00:00:00 2001 From: nemunaire Date: Thu, 2 Apr 2015 19:57:26 +0200 Subject: [PATCH] [xmlparser] Fix date extraction when using old format --- nemubot/tools/xmlparser/node.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nemubot/tools/xmlparser/node.py b/nemubot/tools/xmlparser/node.py index a070e22..3606ac7 100644 --- a/nemubot/tools/xmlparser/node.py +++ b/nemubot/tools/xmlparser/node.py @@ -85,8 +85,8 @@ class ModuleState: except ValueError: while True: try: - import time - return time.strptime(source[:19], "%Y-%m-%d %H:%M:%S").replace(tzinfo=timezone.utc) + import calendar, time + return datetime.utcfromtimestamp(calendar.timegm(time.strptime(source[:19], "%Y-%m-%d %H:%M:%S"))).replace(tzinfo=timezone.utc) except ImportError: pass