summaryrefslogtreecommitdiff
path: root/bin/hafas
diff options
context:
space:
mode:
Diffstat (limited to 'bin/hafas')
-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",