Commit 3606527d authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Use the same DateTime::Format::Strptime object for all Result objects

parent 4a40e7eb
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ our $VERSION = '1.10';

use Carp qw(confess cluck);
use DateTime;
use DateTime::Format::Strptime;
use Encode qw(encode decode);
use List::Util qw(first);
use List::MoreUtils qw(uniq);
@@ -42,6 +43,11 @@ sub new {
		user_agent      => $ua,
		with_related    => $opt{with_related},
		departure_by_id => {},
		strptime_obj    => DateTime::Format::Strptime->new(
			pattern   => '%y%m%d%H%M',
			time_zone => 'Europe/Berlin',
		),

	};

	bless( $self, $class );
@@ -258,6 +264,7 @@ sub add_result {
		line_no      => $e_tl->getAttribute('l'),    # 1 -> S1, ...
		station      => $station,
		unknown_o    => $e_tl->getAttribute('o'),    # owner: 03/80/R2/...
		strptime_obj => $self->{strptime_obj},
	);

	if ($e_ar) {
+1 −1
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ sub new {

	bless( $ref, $obj );

	$ref->{strptime_obj} = DateTime::Format::Strptime->new(
	$ref->{strptime_obj} //= DateTime::Format::Strptime->new(
		pattern   => '%y%m%d%H%M',
		time_zone => 'Europe/Berlin',
	);