diff options
-rw-r--r-- | calc-price | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use 5.016; +use 5.014; use DBI; use Path::Class; use Getopt::Long::Descriptive; @@ -175,12 +175,23 @@ sub update_range { return; } +my $start_from; +if ($ARGV[0]) { + require DateTime::Format::Natural; + $start_from = DateTime::Format::Natural->new( + prefer_future => 0, + time_zone=>'Europe/London', + )->parse_datetime($ARGV[0])->truncate(to=>'day'); +} + while (my $row=$sth->fetchrow_hashref) { my $start_ts = DateTime->from_epoch( epoch=> $row->{start_ts}, time_zone=>'Europe/London', ); + next if $start_from && $start_ts < $start_from; + my $day_key= day_of_journey($start_ts)->ymd; my @journey;my ($peak,$tube,$start_zone,$stop_zone)=(0,0,0,0); |