summaryrefslogtreecommitdiff
path: root/bin/efa-m
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-10-06 13:21:58 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-10-06 13:21:58 +0200
commit64c3769d3d8c746af09260c21bcd4ce29612aaab (patch)
tree11f320222c1cb6dee1b0ab91ddef98b3ad04fb2b /bin/efa-m
parent2114f50999b979c0cd96ea04a64181b9c6f6665d (diff)
-Of etc: show delays
Diffstat (limited to 'bin/efa-m')
-rwxr-xr-xbin/efa-m20
1 files changed, 16 insertions, 4 deletions
diff --git a/bin/efa-m b/bin/efa-m
index 35f70c3..2dd4b09 100755
--- a/bin/efa-m
+++ b/bin/efa-m
@@ -297,17 +297,29 @@ sub display_result {
sub show_stopseq {
my $trip = $efa->result;
- printf( "%s %s → %s\n",
- $trip->line, $trip->number // q{},
- $trip->dest_name );
+ printf( "%s %s → %s\n", $trip->type, $trip->line // q{}, $trip->dest_name );
+
+ printf(
+ "Fahrt %s am %s\n",
+ $trip->number || $stopseq,
+ ( $trip->route )[0]->sched_dep->strftime('%d.%m.%Y'),
+ );
+ say q{};
+
+ my $delay_len = 0;
+ my $max_delay = max map { abs( $_->delay // 0 ) } $trip->route;
+ if ($max_delay) {
+ $delay_len = length( sprintf( '%+d', $max_delay ) ) + 1;
+ }
for my $stop ( $trip->route ) {
printf(
- "%s → %s %s (%s) %s\n",
+ "%s → %s%${delay_len}s %s (%s) %s\n",
$stop->arr ? $stop->arr->strftime('%H:%M')
: q{ },
$stop->dep ? $stop->dep->strftime('%H:%M')
: q{ },
+ $stop->delay ? sprintf( ' %+d', $stop->delay ) : q{},
$stop->full_name,
$stop->niveau,
$stop->platform