Hi !
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).
I have had a look at DateTime::Span, but unfortunately I'm a little bit
confused...
I build a "Span":
$iso8601 = DateTime::Format::ISO8601->new;
$blackout_dt_start = $iso8601->parse_datetime( "22:00" );
$blackout_dt_end = $iso8601->parse_datetime( "23:00" );
$span = DateTime::Span->from_datetimes( start => $blackout_dt_start, end =>
$blackout_dt_end );
and made the checks:
while (1)
{
my $dt_now = DateTime->now;
if ( $span->contains( $dt_now))
{
print " Inside Blackout...no checks !";
}
else
{
print " Outside Blackout...";
do_check();
}
sleep (60);
}
My question: how to build recurring "span" for every day? I have had a look
at DateTime::SpanSet but there
is no method "from_span_and_duration" like the existing method
"from_set_and_duration"....
---
Oliver Raupach