You can also do that with a single
DateTime::Incomplete object!
---
use strict;
use DateTime::Incomplete;
# blackout is at 10 o'clock
my $blackout =
DateTime::Incomplete->new(
hour => 22,
);
print "blackout time is ",
$blackout->datetime, "\n";
test( DateTime->now );
test( DateTime->now->set( hour => 22 ) );
test( DateTime->now->set( hour => 23 ) );
sub test {
print $_[0]->datetime;
if ( $blackout->contains( $_[0] ) )
{
print " Inside Blackout...no checks !\n";
}
else
{
print " Outside Blackout...\n";
}
}
---
blackout time is xxxx-xx-xxT22:xx:xx
2004-02-26T14:40:16 Outside Blackout...
2004-02-26T22:40:16 Inside Blackout...no checks !
2004-02-26T23:40:16 Outside Blackout...
---
- Flavio S. Glock
> > > I have to do some checks every minute. For
> maintenance I have to define a
> > > blackout-period with
> > > no checks (example: blackout start 22:00, end:
> 23:00, interval: daily).
..
> > >
> > > Oliver Raupach