Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Representing windows of time in a string

by simonm (Vicar)
on Oct 30, 2003 at 16:50 UTC ( #303315=note: print w/replies, xml ) Need Help??


in reply to Representing windows of time in a string

Strictly speaking, crontab schedules define "points" in time when the specific actions are triggered, whereas it seems you need a broader "range" or "set" of time spans.

It might be overkill, but I think you should be able to accomplish this with the DateTime modules.

For example, take a look at DateTime::Event::ICal... Using the ICal format, you could express your rules as:

my $incident = DateTime->from_epoch( time() ); # your data here my $ok_down = DateTime::Event::ICal->recur( byday=>["su"], byhour=>[ +6, 7] ); unless ( $ok_down->contains( $incident ) { # notify }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://303315]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2023-06-10 23:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (39 votes). Check out past polls.

    Notices?