diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-04-02 14:40:15 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-04-02 14:40:15 +0200 |
commit | fb76c6eb57c20177eca19d6fe03a573f378654f8 (patch) | |
tree | e5d05b7e2e93600c50d99c6c99dc7b590db150bc /bin/hafas-m | |
parent | 748fbc7695bafd467bf8e61d160971bcf5139d15 (diff) |
Use service-specific time zones if ≠ Europe/Berlin
Diffstat (limited to 'bin/hafas-m')
-rwxr-xr-x | bin/hafas-m | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/bin/hafas-m b/bin/hafas-m index 8bed8e5..9b861a2 100755 --- a/bin/hafas-m +++ b/bin/hafas-m @@ -95,7 +95,9 @@ elsif ( $opt{station} =~ m{ ^ [!] (?<query> .*) $ }x ) { } if ( $date or $time ) { - my $dt = DateTime->now( time_zone => 'Europe/Berlin' ); + my $desc = Travel::Status::DE::HAFAS::get_service($service) // {}; + my $dt + = DateTime->now( time_zone => $desc->{time_zone} // 'Europe/Berlin' ); if ($date) { if ( $date =~ m{ ^ (?<day> \d{1,2} ) [.] (?<month> \d{1,2} ) [.] (?<year> \d{4})? $ }x @@ -355,7 +357,7 @@ if ( $opt{journeyMatch} ) { say $result->id; print $result->name; if ( $result->number ) { - printf( " | Zug %s", $result->number ); + printf( " | Nr %s", $result->number ); } if ( $result->line_no ) { printf( " | Linie %s", $result->line_no ); @@ -396,7 +398,7 @@ elsif ( $opt{journey} ) { printf( "%s → %s", $result->name, $result->route_end ); if ( $result->number ) { - printf( " / Zug %s", $result->number ); + printf( " / Nr %s", $result->number ); } if ( $result->line_no ) { printf( " / Linie %s", $result->line_no ); @@ -446,7 +448,9 @@ elsif ( $opt{journey} ) { } $prev_prod = 0; - my $now = DateTime->now( time_zone => 'Europe/Berlin' ); + my $desc = Travel::Status::DE::HAFAS::get_service($service) // {}; + my $now + = DateTime->now( time_zone => $desc->{time_zone} // 'Europe/Berlin' ); my $mark_stop = 0; for my $i ( reverse 1 .. scalar $result->route ) { my $stop = ( $result->route )[ $i - 1 ]; |