122 if when==math.inf: |
122 if when==math.inf: |
123 whenstr='--' |
123 whenstr='--' |
124 else: |
124 else: |
125 tnow=datetime.datetime.fromtimestamp(now) |
125 tnow=datetime.datetime.fromtimestamp(now) |
126 twhen=datetime.datetime.fromtimestamp(when) |
126 twhen=datetime.datetime.fromtimestamp(when) |
127 tendtoday=twhen.replace(hour=23,minute=59,second=59) |
127 tendtoday=tnow.replace(hour=23,minute=59,second=59) |
128 tendtomorrow=tendtoday+datetime.timedelta(days=1) |
128 tendtomorrow=tendtoday+datetime.timedelta(days=1) |
129 diff=datetime.timedelta(seconds=when-now) |
|
130 |
129 |
131 if twhen<tnow: |
130 if twhen<tnow: |
132 whenstr='overdue' + (' on %s' % twhen.isoformat()) |
131 whenstr='overdue' + (' on %s' % twhen.isoformat()) |
133 elif twhen>tendtomorrow: |
132 elif twhen>tendtomorrow: |
134 # Display date if scheduled event is after tomorrow |
133 # Display date if scheduled event is after tomorrow |
135 whenday=datetime.date.fromtimestamp(when) |
134 whenday=datetime.date.fromtimestamp(when) |
136 whenstr='on %s' % twhen.date().isoformat() |
135 whenstr='on %s' % twhen.date().isoformat() |
137 this_refresh_time=tendtoday+datetime.timedelta(seconds=1) |
136 this_refresh_time=tendtoday+datetime.timedelta(seconds=1) |
138 elif twhen>tendtoday and diff.seconds>=12*60*60: # 12 hours |
137 elif twhen>tendtoday and when-now>=12*60*60: # 12 hours |
139 # Display 'tomorrow' if the scheduled event is tomorrow and |
138 # Display 'tomorrow' if the scheduled event is tomorrow and |
140 # not earlier than after 12 hours |
139 # not earlier than after 12 hours |
141 whenstr='tomorrow' |
140 whenstr='tomorrow' |
142 this_refresh_time=twhen-datetime.timedelta(hours=12) |
141 this_refresh_time=twhen-datetime.timedelta(hours=12) |
143 else: |
142 else: |