summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-10-17 06:53:26 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-10-17 06:53:44 +0200
commit12460afd1238e6d4426f731afcde14d13face8e7 (patch)
tree55ffc80cb2fd67035556b2766d8cb6396f28efda /bin
parent663a1723da54c7a06e870447b1c60f845bd960aa (diff)
efa-m: show trip detail delays in braces (we're outputting realtime data)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/efa-m11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/efa-m b/bin/efa-m
index 51f1585..99622ba 100755
--- a/bin/efa-m
+++ b/bin/efa-m
@@ -345,10 +345,12 @@ sub show_stopseq {
);
say q{};
- my $delay_len = 0;
- my $max_delay = max map { abs( $_->delay // 0 ) } $trip->route;
+ my $delay_len = 0;
+ my $inner_delay_len = 0;
+ my $max_delay = max map { abs( $_->delay // 0 ) } $trip->route;
if ($max_delay) {
- $delay_len = length( sprintf( '%+d', $max_delay ) ) + 1;
+ $inner_delay_len = length($max_delay) + 1;
+ $delay_len = length( sprintf( '(%+d)', $max_delay ) ) + 1;
}
for my $stop ( $trip->route ) {
@@ -358,7 +360,8 @@ sub show_stopseq {
: q{ },
$stop->dep ? $stop->dep->strftime('%H:%M')
: q{ },
- $stop->delay ? sprintf( ' %+d', $stop->delay ) : q{},
+ $stop->delay ? sprintf( " (%+${inner_delay_len}d)", $stop->delay )
+ : q{},
$stop->full_name,
$stop->niveau,
$stop->platform