summaryrefslogtreecommitdiffstats
path: root/py3status/__init__.py
diff options
context:
space:
mode:
authorUltrabug <ultrabug@gentoo.org>2015-03-12 18:38:15 +0100
committerUltrabug <ultrabug@gentoo.org>2015-03-12 18:38:15 +0100
commitca8185b50aa29d452a52c00dd2d12535ee6074ed (patch)
treea1d1a5caa102fe40625a8a5114b553ae98167019 /py3status/__init__.py
parenta7119803c420373903ac289eb44fc01b64a58ef7 (diff)
catch daylight savings time change, fix issue #75 thx to @Gamonics
Diffstat (limited to 'py3status/__init__.py')
-rwxr-xr-xpy3status/__init__.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/py3status/__init__.py b/py3status/__init__.py
index d98b83d..226448b 100755
--- a/py3status/__init__.py
+++ b/py3status/__init__.py
@@ -8,7 +8,7 @@ import sys
from collections import OrderedDict
from contextlib import contextmanager
from copy import deepcopy
-from datetime import datetime, timedelta
+from datetime import datetime
from json import dumps, loads
from signal import signal
from signal import SIGTERM, SIGUSR1
@@ -346,9 +346,6 @@ class I3status(Thread):
# get a datetime from the parsed string date
date = datetime.strptime(i3s_time, time_fmt)
-
- # i3status output delay adjustment
- date += timedelta(seconds=1)
except Exception:
err = sys.exc_info()[1]
syslog(
@@ -373,6 +370,10 @@ class I3status(Thread):
with respect to their parsed and timezone offset detected on start.
"""
utcnow = datetime.utcnow()
+ # every whole minute, resync our time from i3status'
+ # this ensures we will catch any daylight savings time change
+ if utcnow.second == 0:
+ self.set_time_modules()
#
for index, item in enumerate(json_list):
if item.get('name') in ['time', 'tztime']: