summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen/Helper/HAFAS.pm
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-04-03 14:44:59 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-04-03 14:44:59 +0200
commit7152cb55a726f86fd7451286c8302ec4cb137da8 (patch)
treed04407abfa47b73cd1785508b83d60dda27d4d3d /lib/DBInfoscreen/Helper/HAFAS.pm
parent1893167d1a4403dda6ed07870fa6c83263099946 (diff)
show local time if it differs from backend time
Diffstat (limited to 'lib/DBInfoscreen/Helper/HAFAS.pm')
-rw-r--r--lib/DBInfoscreen/Helper/HAFAS.pm27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/DBInfoscreen/Helper/HAFAS.pm b/lib/DBInfoscreen/Helper/HAFAS.pm
index 149bfc9..59d8c7b 100644
--- a/lib/DBInfoscreen/Helper/HAFAS.pm
+++ b/lib/DBInfoscreen/Helper/HAFAS.pm
@@ -119,6 +119,7 @@ sub get_route_p {
dep_delay => $stop->dep_delay,
arr_cancelled => $stop->arr_cancelled,
dep_cancelled => $stop->dep_cancelled,
+ tz_offset => $stop->tz_offset,
platform => $stop->platform,
sched_platform => $stop->sched_platform,
load => $stop->load,
@@ -142,6 +143,32 @@ sub get_route_p {
$station_is_past = 0;
}
$ret[-1]{isPast} = $station_is_past;
+ if ( $stop->tz_offset ) {
+ if ( $stop->sched_arr ) {
+ $ret[-1]{local_sched_arr}
+ = $stop->sched_arr->clone->add(
+ minutes => $stop->tz_offset );
+ }
+ if ( $stop->sched_dep ) {
+ $ret[-1]{local_sched_dep}
+ = $stop->sched_dep->clone->add(
+ minutes => $stop->tz_offset );
+ }
+ if ( $stop->rt_arr ) {
+ $ret[-1]{local_rt_arr} = $stop->rt_arr->clone->add(
+ minutes => $stop->tz_offset );
+ }
+ if ( $stop->rt_dep ) {
+ $ret[-1]{local_rt_dep} = $stop->rt_dep->clone->add(
+ minutes => $stop->tz_offset );
+ }
+ $ret[-1]{local_dt_ad} = $ret[-1]{local_rt_arr}
+ // $ret[-1]{local_sched_arr} // $ret[-1]{local_rt_dep}
+ // $ret[-1]{local_sched_dep};
+ $ret[-1]{local_dt_da} = $ret[-1]{local_rt_dep}
+ // $ret[-1]{local_sched_dep} // $ret[-1]{local_rt_arr}
+ // $ret[-1]{local_sched_arr};
+ }
}
$promise->resolve( \@ret, $journey, $hafas );