diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2023-11-11 00:44:22 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2023-11-11 00:44:22 +0100 |
commit | 58fe3b8be3c434610354e9954e630da3146cc01a (patch) | |
tree | 931f56226238f619da2a129818c48f9703a49fce /bin/hafas | |
parent | 4520981dde8d12a18632b598f1c02a6649cde9f3 (diff) |
expose transfer times between consecutive connection sections
Diffstat (limited to 'bin/hafas')
-rwxr-xr-x | bin/hafas | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -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", |