summaryrefslogtreecommitdiff
path: root/lib/Travel/Routing/DE/HAFAS/Utils.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel/Routing/DE/HAFAS/Utils.pm')
-rw-r--r--lib/Travel/Routing/DE/HAFAS/Utils.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Travel/Routing/DE/HAFAS/Utils.pm b/lib/Travel/Routing/DE/HAFAS/Utils.pm
index 5b26555..45ee5db 100644
--- a/lib/Travel/Routing/DE/HAFAS/Utils.pm
+++ b/lib/Travel/Routing/DE/HAFAS/Utils.pm
@@ -13,8 +13,13 @@ sub handle_day_change {
my (%opt) = @_;
my $datestr = $opt{date};
my $timestr = $opt{time};
+ my $tz_offset = $opt{offset};
my $offset_days = 0;
+ if ( not defined $timestr ) {
+ return;
+ }
+
# timestr may include a day offset, resulting in DDHHMMSS
if ( length($timestr) == 8 ) {
$offset_days = substr( $timestr, 0, 2, q{} );
@@ -26,6 +31,11 @@ sub handle_day_change {
$ts->add( days => $offset_days );
}
+ if ( defined $tz_offset and $tz_offset != $ts->offset / 60 ) {
+ my $ts_offset = $tz_offset - $ts->offset / 60;
+ $ts->subtract( minutes => $ts_offset );
+ }
+
return $ts;
}