UI time display fixes

Tue, 06 Feb 2018 20:55:53 +0000

author
Tuomo Valkonen <tuomov@iki.fi>
date
Tue, 06 Feb 2018 20:55:53 +0000
changeset 112
173d9d7048b6
parent 111
c3bc27cf5ece
child 113
6993964140bd

UI time display fixes

borgend/ui.py file | annotate | diff | comparison | revisions
--- a/borgend/ui.py	Tue Feb 06 20:16:59 2018 +0000
+++ b/borgend/ui.py	Tue Feb 06 20:55:53 2018 +0000
@@ -124,9 +124,8 @@
         else:
             tnow=datetime.datetime.fromtimestamp(now)
             twhen=datetime.datetime.fromtimestamp(when)
-            tendtoday=twhen.replace(hour=23,minute=59,second=59)
+            tendtoday=tnow.replace(hour=23,minute=59,second=59)
             tendtomorrow=tendtoday+datetime.timedelta(days=1)
-            diff=datetime.timedelta(seconds=when-now)
 
             if twhen<tnow:
                 whenstr='overdue' + (' on %s' % twhen.isoformat())
@@ -135,7 +134,7 @@
                 whenday=datetime.date.fromtimestamp(when)
                 whenstr='on %s' % twhen.date().isoformat()
                 this_refresh_time=tendtoday+datetime.timedelta(seconds=1)
-            elif twhen>tendtoday and diff.seconds>=12*60*60: # 12 hours
+            elif twhen>tendtoday and when-now>=12*60*60: # 12 hours
                 # Display 'tomorrow' if the scheduled event is tomorrow and
                 # not earlier than after 12 hours
                 whenstr='tomorrow'

mercurial