From 57b93c346efcd3b180f24cf19e78dd3ceab0cd1d Mon Sep 17 00:00:00 2001 From: dakkar Date: Mon, 27 May 2013 17:26:09 +0100 Subject: show predicted arrivals --- forecast.html.tt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'forecast.html.tt') 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; -%] @@ -23,6 +32,7 @@ } .timeline { position: relative; + height: 6em; } .stripes { position: absolute; @@ -127,7 +137,7 @@ [% p.LineName %] [% p.DestinationText %] - [% p.EstimatedTime %] + [% minsec_until(p.EstimatedTime) %] [% END %] -- cgit v1.2.3