muted = True
lines = alert.split("\n")
import time
- valid_time = time.strftime("%Y%m%d%H%M")
+ # TODO: make this offset configurable
+ # TODO: adjust offset relative to the difference between the user's
+ # local time and the zone's local time (will need to extend
+ # the schema in the zones file to store each tz
+ offset = 86400 # one day
+
+ # report alerts and forecasts that expired less than offset ago;
+ # this is a cheap hack since expiration times seem to be relative
+ # to the zone's local timezone, and converting from the user's
+ # would get complicated, but also there can sometimes be a lag
+ # between expiration and the next update
+ valid_time = time.strftime(
+ "%Y%m%d%H%M", time.localtime(time.time() - offset))
output = []
for line in lines:
if line.startswith("Expires:") \