diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-08-05 18:22:08 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-08-05 18:22:08 +0200 |
commit | dfc671161cc3829f3b84af04014b94ace621eb8e (patch) | |
tree | 68e3aae3d7d5413f1e7c087ebe42ee447cbcdd35 /lib/Travel/Status/DE/IRIS.pm | |
parent | 89151e8b3d22fbdc6ab417a3e7c445dc737e3bcd (diff) |
Compare lookahead to scheduled and not realtime data
Diffstat (limited to 'lib/Travel/Status/DE/IRIS.pm')
-rw-r--r-- | lib/Travel/Status/DE/IRIS.pm | 12 |
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 |