From 43fbf64bc77682e0f4d0657d6c31d635e7343e6f Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 7 Apr 2018 08:24:16 +0200 Subject: db-iris: Support "--date tomorrow" --- bin/db-iris | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/bin/db-iris b/bin/db-iris index 9551023..1e640d5 100755 --- a/bin/db-iris +++ b/bin/db-iris @@ -71,21 +71,26 @@ if ($track_via) { if ($date) { my ( $day, $month, $year ) = split( qr{ [.] }x, $date ); - if ( not( defined $day and defined $month ) + if ( $date eq 'tomorrow' ) { + $datetime->add( days => 1 ); + } + elsif (not( defined $day and defined $month ) or ( $day < 1 ) or ( $day > 31 ) or ( $month < 1 ) or ( $month > 12 ) ) { - say STDERR "-d/--date: Please specify a valid date"; + say STDERR +"-d/--date: Please specify a valid date (dd.mm. / dd.mm.YYYY / tomorrow)"; exit(3); } - - $datetime->set( - day => $day, - month => $month, - year => $year || $datetime->year, - ); + else { + $datetime->set( + day => $day, + month => $month, + year => $year || $datetime->year, + ); + } } if ($time) { my ( $hour, $minute, $second ) = split( qr{ : }x, $time ); @@ -567,7 +572,8 @@ Valid classes are: =item B<-d>, B<--date> I -Request results for I in dd.mm. or dd.mm.YYYY format. Note that only +Request results for I, which is either a date string in in I
.I. +or I
.I.I format, or C<< tomorrow >>. Note that typically only slight (a few hours max) deviations from the current time are supported by the IRIS backend, larger ones will not return data. -- cgit v1.2.3