summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-11-11 00:44:22 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2023-11-11 00:44:22 +0100
commit58fe3b8be3c434610354e9954e630da3146cc01a (patch)
tree931f56226238f619da2a129818c48f9703a49fce /bin
parent4520981dde8d12a18632b598f1c02a6649cde9f3 (diff)
expose transfer times between consecutive connection sections
Diffstat (limited to 'bin')
-rwxr-xr-xbin/hafas18
1 files changed, 16 insertions, 2 deletions
diff --git a/bin/hafas b/bin/hafas
index 0d89c9f..b36b337 100755
--- a/bin/hafas
+++ b/bin/hafas
@@ -254,8 +254,22 @@ for my $res ( @{ $hafas->{results} } ) {
# say "# cancelled\n";
#}
- my $glance = join( ' - ',
- map { $_->name } grep { $_->type eq 'JNY' } $res->sections );
+ my $glance = q{};
+ for my $sec ( $res->sections ) {
+ if ( $sec->type ne 'JNY' ) {
+ next;
+ }
+ if ( defined $sec->transfer_duration ) {
+ $glance .= sprintf(
+ ' (%01d:%02d) %s',
+ $sec->transfer_duration->in_units( 'hours', 'minutes' ),
+ $sec->name
+ );
+ }
+ else {
+ $glance .= $sec->name;
+ }
+ }
printf(
"# %02d:%02d %s %s\n",