Unverified Commit f67d8f4d authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

IRIS->get_departures_p: add support for datetime argument

Closes #375
parent 8e673786
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -99,6 +99,10 @@ sub get_departures_p {
	my $lookahead    = $opt{lookahead}    // 30;
	my $with_related = $opt{with_related} // 0;

	my $datetime
	  = ( $opt{datetime} // DateTime->now( time_zone => 'Europe/Berlin' ) )
	  ->subtract( minutes => $lookbehind );

	# Berlin Hbf exists twice:
	# - BLS / 8011160
	# - BL / 8098160 (formerly "Berlin Hbf (tief)")
@@ -125,8 +129,7 @@ sub get_departures_p {
			realtime_cache => $self->{realtime_cache},
			keep_transfers => 1,
			lookbehind     => 20,
			datetime       => DateTime->now( time_zone => 'Europe/Berlin' )
			  ->subtract( minutes => $lookbehind ),
			datetime       => $datetime,
			lookahead      => $lookbehind + $lookahead,
			lwp_options    => {
				timeout => 10,
@@ -212,9 +215,9 @@ sub get_connections_p {

	$self->get_departures_p(
		station      => $opt{station},
		timestamp    => $opt{timestamp},
		datetime     => $opt{timestamp},
		lookbehind   => 0,
		lookahead    => 60,
		lookahead    => 90,
		with_related => 1,
	)->then(
		sub {