summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-06-29 05:52:12 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2025-06-29 05:52:12 +0200
commitfc7ff5b6d7d285e1962e46c7ddbf304ebc7f1aa7 (patch)
treecf3e3f0ca79974bbe8f9fe8cee5f0cb438a6f5f8
parent3b80a60300472349630ce81fd8ca6534e9a24a20 (diff)
Journeys->get: pre-compute delay data
-rwxr-xr-xlib/Travelynx/Model/Journeys.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm
index 7c92664..38df763 100755
--- a/lib/Travelynx/Model/Journeys.pm
+++ b/lib/Travelynx/Model/Journeys.pm
@@ -691,6 +691,12 @@ sub get {
$ref->{checkout} = epoch_to_dt( $ref->{checkout_ts} );
$ref->{sched_arrival} = epoch_to_dt( $ref->{sched_arr_ts} );
$ref->{rt_arrival} = epoch_to_dt( $ref->{rt_arr_ts} );
+ if ( $ref->{rt_dep_ts} and $ref->{sched_dep_ts} ) {
+ $ref->{delay_dep} = $ref->{rt_dep_ts} - $ref->{sched_dep_ts};
+ }
+ if ( $ref->{rt_arr_ts} and $ref->{sched_arr_ts} ) {
+ $ref->{delay_arr} = $ref->{rt_arr_ts} - $ref->{sched_arr_ts};
+ }
}
if ( $opt{with_route_datetime} ) {
for my $stop ( @{ $ref->{route} } ) {