diff options
Diffstat (limited to 'forecast.html.tt')
-rw-r--r-- | forecast.html.tt | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/forecast.html.tt b/forecast.html.tt index a3cb750..82d8412 100644 --- a/forecast.html.tt +++ b/forecast.html.tt @@ -5,12 +5,21 @@ hourly = f.hourly.slice('from', today_start, 'to', today_stop); MACRO hours_length(span) BLOCK; d=span.stop_time.subtract_datetime(span.start_time); - v=d.in_units('days','hours'); - v.0 * 24 + v.1; + format_duration( + 'pattern','%k', + 'base',span.start_time, + 'normalize',1).format_duration(d); END; MACRO time(d) BLOCK; d.clone.set_time_zone('Europe/London').strftime('%H:%M'); END; + MACRO minsec_until(d) BLOCK; + dur=d.subtract_datetime(now); + format_duration( + 'pattern','%M:%S', + 'base',now, + 'normalize',1).format_duration(dur); + END; -%] <html> <head> @@ -23,6 +32,7 @@ } .timeline { position: relative; + height: 6em; } .stripes { position: absolute; @@ -127,7 +137,7 @@ <tr> <td>[% p.LineName %]</td> <td>[% p.DestinationText %]</td> - <td>[% p.EstimatedTime %]</td> + <td>[% minsec_until(p.EstimatedTime) %]</td> </tr> [% END %] </tbody> |