summaryrefslogtreecommitdiffstats
path: root/py3status
diff options
context:
space:
mode:
authorUltrabug <ultrabug@gentoo.org>2013-03-25 10:43:17 +0100
committerUltrabug <ultrabug@gentoo.org>2013-03-25 10:43:17 +0100
commitb620157a393a86ce2b10c823e569ea1ef069165c (patch)
treee3048af3e5b1250d93d5b22a3ad624fc7d778359 /py3status
parent1bb0856652043c1783dec083f2d255cffef0ce0a (diff)
fix time transformation thx to Lujeni
Diffstat (limited to 'py3status')
-rwxr-xr-xpy3status/__init__.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/py3status/__init__.py b/py3status/__init__.py
index 5324385..9410ed5 100755
--- a/py3status/__init__.py
+++ b/py3status/__init__.py
@@ -206,11 +206,15 @@ def transform(j, **kwargs):
- update the 'time' object so that it's updated at INTERVAL seconds
- update the 'run_watch' objects so that we rely on the color instead of useless 'yes' or 'no' status
"""
- for item in j:
- # time modification
- if item['name'] == 'time':
- date = datetime.strptime(item['full_text'], I3STATUS_CONFIG['time_format']) + timedelta(seconds=kwargs['delta'])
- item['full_text'] = date.strftime(I3STATUS_CONFIG['time_format'])
+ try:
+ for item in j:
+ # time modification
+ if item['name'] in [ 'time', 'tztime' ]:
+ date = datetime.strptime(item['full_text'], I3STATUS_CONFIG['time_format']) + timedelta(seconds=kwargs['delta'])
+ item['full_text'] = date.strftime(I3STATUS_CONFIG['time_format'])
+ except Exception:
+ err = sys.exc_info()[1]
+ syslog(LOG_ERR, "transformation failed (%s)" % (str(err)))
return j
def load_from_file(filepath):