summaryrefslogtreecommitdiff
path: root/src/common.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-07-14 18:26:01 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-07-14 18:26:01 +0000
commit93351156a122dd7e374778c1c838b5c4c1dda83d (patch)
tree27566d15029a62b073f6fa4965a8ebcb956137d1 /src/common.py
parent25e82efebfe97b3efc6366bf32eaf7282c69bc39 (diff)
downloadpoezio-93351156a122dd7e374778c1c838b5c4c1dda83d.tar.gz
poezio-93351156a122dd7e374778c1c838b5c4c1dda83d.tar.bz2
poezio-93351156a122dd7e374778c1c838b5c4c1dda83d.tar.xz
poezio-93351156a122dd7e374778c1c838b5c4c1dda83d.zip
history time is now correct. fixed #1571
Diffstat (limited to 'src/common.py')
-rw-r--r--src/common.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/common.py b/src/common.py
index 3edc9e14..4406e4cb 100644
--- a/src/common.py
+++ b/src/common.py
@@ -33,7 +33,7 @@
"""
various useful functions
"""
-
+from datetime import datetime, timedelta
import base64
import os
import mimetypes
@@ -44,6 +44,7 @@ import sys
import select
import errno
import xmpp
+import time
def debug(string):
"""
@@ -261,7 +262,8 @@ def datetime_tuple(timestamp):
"""
timestamp = timestamp.split('.')[0]
timestamp = timestamp.replace('-', '')
- timestamp = timestamp.replace('z', '')
- timestamp = timestamp.replace('Z', '')
- from datetime import datetime
- return datetime.strptime(timestamp, '%Y%m%dT%H:%M:%S')
+ ret = datetime.strptime(timestamp, '%Y%m%dT%H:%M:%SZ')
+ # convert UTC to local time, with DST etc.
+ dst = timedelta(seconds=time.altzone)
+ ret -= dst
+ return ret