summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2013-12-23 20:09:40 +0100
committerDaniel Friesel <derf@finalrewind.org>2013-12-23 20:09:40 +0100
commitf295a96773aa512cbd71131cfae7691455ccf777 (patch)
tree374f1e128187876b2613e608776ca6a70df21427
parent59c281597e93d9da9e70be7acc7f431194732b2e (diff)
optimize hide_past (check first, invoke DateTime later)
-rw-r--r--lib/Travel/Status/DE/URA.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Travel/Status/DE/URA.pm b/lib/Travel/Status/DE/URA.pm
index c525ffd..4683f34 100644
--- a/lib/Travel/Status/DE/URA.pm
+++ b/lib/Travel/Status/DE/URA.pm
@@ -148,16 +148,18 @@ sub results {
next;
}
+ $timestamp /= 1000;
+
+ if ( $hide_past and $ts_now > $timestamp ) {
+ next;
+ }
+
my $dt_dep = DateTime->from_epoch(
- epoch => $timestamp / 1000,
+ epoch => $timestamp,
time_zone => 'Europe/Berlin'
);
my $ts_dep = $dt_dep->epoch;
- if ( $hide_past and $dt_dep->subtract_datetime($dt_now)->is_negative ) {
- next;
- }
-
if ($full_routes) {
@route = map { [ $_->[9] / 1000, $_->[1] ] }
grep { $_->[8] == $tripid } @{ $self->{raw_list} };