summaryrefslogtreecommitdiff
path: root/forecast.html.tt
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2013-05-27 17:26:09 +0100
committerdakkar <dakkar@thenautilus.net>2013-05-27 17:26:09 +0100
commit57b93c346efcd3b180f24cf19e78dd3ceab0cd1d (patch)
tree89a2502aef8078d920806578ab70b5f07e1bf65c /forecast.html.tt
parentfactored TFL client (diff)
downloadHomePanel-57b93c346efcd3b180f24cf19e78dd3ceab0cd1d.tar.gz
HomePanel-57b93c346efcd3b180f24cf19e78dd3ceab0cd1d.tar.bz2
HomePanel-57b93c346efcd3b180f24cf19e78dd3ceab0cd1d.zip
show predicted arrivals
Diffstat (limited to 'forecast.html.tt')
-rw-r--r--forecast.html.tt16
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>