summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-04-03 01:33:59 +0200
committermathieui <mathieui@mathieui.net>2014-04-03 01:33:59 +0200
commitb6d607075160dffea769c6ad49e4303e48722ed4 (patch)
treee2b7bc2bf224b26ff814a8d4e7846634020c1a61
parentace9fc6661d1d440d5c7a37553c4dff9fb525541 (diff)
downloadpoezio-b6d607075160dffea769c6ad49e4303e48722ed4.tar.gz
poezio-b6d607075160dffea769c6ad49e4303e48722ed4.tar.bz2
poezio-b6d607075160dffea769c6ad49e4303e48722ed4.tar.xz
poezio-b6d607075160dffea769c6ad49e4303e48722ed4.zip
Update the ugly timestamp fixes for better DST detection
-rw-r--r--src/common.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/common.py b/src/common.py
index 62216b5e..1ec2a42a 100644
--- a/src/common.py
+++ b/src/common.py
@@ -242,7 +242,7 @@ def get_utc_time(local_time=None):
isdst = time.localtime().tm_isdst
else:
if OLD_PYTHON:
- isdst = time.localtime().tm_isdst
+ isdst = time.localtime(int(local_time.strftime("%s"))).tm_isdst
else:
isdst = time.localtime(int(local_time.timestamp())).tm_isdst
@@ -266,9 +266,10 @@ def get_local_time(utc_time):
True
"""
if OLD_PYTHON:
- isdst = time.localtime().tm_isdst
+ isdst = time.localtime(int(utc_time.strftime("%s"))).tm_isdst
else:
isdst = time.localtime(int(utc_time.timestamp())).tm_isdst
+
if time.daylight and isdst:
tz = timedelta(seconds=time.altzone)
else: