summaryrefslogtreecommitdiff
path: root/lib/Travel/Routing/DE/HAFAS/Connection
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-04-02 17:04:25 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-04-02 17:04:25 +0200
commitf40128dedfd431e91960e1271f1a677369941058 (patch)
tree4014d4f069e836349d751f9702b36f0de7322945 /lib/Travel/Routing/DE/HAFAS/Connection
parente6480f632d07b30f4f3ee538731f157c922a16b2 (diff)
Convert non-local timestamps to local time zone
Diffstat (limited to 'lib/Travel/Routing/DE/HAFAS/Connection')
-rw-r--r--lib/Travel/Routing/DE/HAFAS/Connection/Section.pm38
1 files changed, 24 insertions, 14 deletions
diff --git a/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm b/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm
index 552401b..09032af 100644
--- a/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm
+++ b/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm
@@ -58,20 +58,30 @@ sub new {
time_zone => 'Europe/Berlin'
);
- my $sched_dep = $sec->{dep}{dTimeS};
- my $rt_dep = $sec->{dep}{dTimeR};
- my $sched_arr = $sec->{arr}{aTimeS};
- my $rt_arr = $sec->{arr}{aTimeR};
-
- for my $ts ( $sched_dep, $rt_dep, $sched_arr, $rt_arr ) {
- if ($ts) {
- $ts = handle_day_change(
- date => $date,
- time => $ts,
- strp_obj => $strptime,
- );
- }
- }
+ my $sched_dep = handle_day_change(
+ date => $date,
+ time => $sec->{dep}{dTimeS},
+ offset => $sec->{dep}{dTZOffset},
+ strp_obj => $strptime,
+ );
+ my $rt_dep = handle_day_change(
+ date => $date,
+ time => $sec->{dep}{dTimeR},
+ offset => $sec->{dep}{dTZOffset},
+ strp_obj => $strptime,
+ );
+ my $sched_arr = handle_day_change(
+ date => $date,
+ time => $sec->{arr}{aTimeS},
+ offset => $sec->{arr}{aTZOffset},
+ strp_obj => $strptime,
+ );
+ my $rt_arr = handle_day_change(
+ date => $date,
+ time => $sec->{arr}{aTimeR},
+ offset => $sec->{arr}{aTZOffset},
+ strp_obj => $strptime,
+ );
my $tco = {};
for my $tco_id ( @{ $sec->{jny}{dTrnCmpSX}{tcocX} // [] } ) {