summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/efa-m10
-rw-r--r--lib/Travel/Status/DE/EFA.pm8
2 files changed, 17 insertions, 1 deletions
diff --git a/bin/efa-m b/bin/efa-m
index 3956bdb..3960c69 100755
--- a/bin/efa-m
+++ b/bin/efa-m
@@ -91,10 +91,18 @@ sub format_route {
say "BUG";
next;
}
- if ( $stop->{arr_time} eq $stop->{dep_time} ) {
+ if ( not defined $stop->{arr_time} ) {
$output .= sprintf( " %5s %40s %s\n",
$stop->{dep_time}, $stop->{stop}, $stop->{platform}, );
}
+ elsif (not defined $stop->{dep_time}) {
+ $output .= sprintf( "%5s %40s %s\n",
+ $stop->{arr_time}, $stop->{stop}, $stop->{platform}, );
+ }
+ elsif ( $stop->{arr_time} eq $stop->{dep_time} ) {
+ $output .= sprintf( " %5s %40s %s\n",
+ $stop->{dep_time}, $stop->{stop}, $stop->{platform}, );
+ }
else {
$output .= sprintf(
"%5s → %5s %40s %s\n",
diff --git a/lib/Travel/Status/DE/EFA.pm b/lib/Travel/Status/DE/EFA.pm
index 38a4fa8..06ff1c2 100644
--- a/lib/Travel/Status/DE/EFA.pm
+++ b/lib/Travel/Status/DE/EFA.pm
@@ -162,6 +162,10 @@ sub errstr {
sub sprintf_date {
my ($e) = @_;
+ if ($e->getAttribute('day') == -1) {
+ return undef;
+ }
+
return sprintf( '%02d.%02d.%d',
$e->getAttribute('day'),
$e->getAttribute('month'),
@@ -172,6 +176,10 @@ sub sprintf_date {
sub sprintf_time {
my ($e) = @_;
+ if ($e->getAttribute('minute') == -1) {
+ return undef;
+ }
+
return sprintf( '%02d:%02d',
$e->getAttribute('hour'),
$e->getAttribute('minute'),