summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/IRIS.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel/Status/DE/IRIS.pm')
-rw-r--r--lib/Travel/Status/DE/IRIS.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm
index e257c67..21bc599 100644
--- a/lib/Travel/Status/DE/IRIS.pm
+++ b/lib/Travel/Status/DE/IRIS.pm
@@ -131,10 +131,11 @@ sub new {
}
@{ $self->{results} } = grep {
- my $d
- = ( $_->departure // $_->arrival )
- ->subtract_datetime( $self->{datetime} );
- not $d->is_negative and $d->in_units('minutes') < $self->{lookahead}
+ my $d = ( $_->departure // $_->arrival );
+ my $sd = $_->sched_departure // $_->sched_arrival // $d;
+ $d = $d->subtract_datetime( $self->{datetime} );
+ $sd = $sd->subtract_datetime( $self->{datetime} );
+ not $d->is_negative and $sd->in_units('minutes') < $self->{lookahead}
} @{ $self->{results} };
@{ $self->{results} }
@@ -607,7 +608,8 @@ IRIS base url, defaults to C<< http://iris.noncd.db.de/iris-tts/timetable >>.
=item B<lookahead> => I<int>
-Compute only results which are less than I<int> minutes in the future.
+Compute only results which are scheduled less than I<int> minutes in the
+future.
Default: 180 (3 hours).
Note that the DeutscheBahn IRIS backend only provides schedules up to four to