determine the time of
be scheduled for the next minute ‘tick’.
What is needed to make Runt work for a scheduler is a next_time method
TwP
I’m still catching up to this thread but FWIW I am always interested in
making Runt more useful and functional. If I understand the above
correctly, then you’d like a next_time method returning a
Date/DateTime/Time (or whatever) that indicates the next occurrence of
this expression?
Matt
mlipper__at__gmail_dot_com
On 12/1/06, Lipper, Matthew [email protected] wrote:
determine the time of
be scheduled for the next minute ‘tick’.
What is needed to make Runt work for a scheduler is a next_time method
TwP
I’m still catching up to this thread but FWIW I am always interested in
making Runt more useful and functional. If I understand the above
correctly, then you’d like a next_time method returning a
Date/DateTime/Time (or whatever) that indicates the next occurrence of
this expression?
Bingo!
From the tutorial example …
last_thursday = DIMonth.new(Last_of,Thursday)
august = REYear.new(8)
expr = last_thursday & august
expr.next_time #=> or some equally clever method name
Here returns the Time object that represents the last Thursday in
August – probably midnight since that is when Thursday starts.
mon_wed_fri = DIWeek.new(Mon) | DIWeek.new(Wed) | DIWeek.new(Fri)
mon_wed_fri.next_time
Since today is Friday, this example would return the Time object that
represents the next Monday from today.
Maybe just “next” instead of “next_time” ??
Any chance of getting Runt and Chronic to play nicely together?
Blessings,
TwP
On Sat, 2 Dec 2006, Lipper, Matthew wrote:
I’m still catching up to this thread but FWIW I am always interested in
making Runt more useful and functional. If I understand the above correctly,
then you’d like a next_time method returning a Date/DateTime/Time (or
whatever) that indicates the next occurrence of this expression?
here’s what i’d like
inclusive_endpoint = Time.now + 7.days
runt.next_times inclusive_endpoint #=> array of all times covered
between
# now and endpoint, ‘now’
should be an
# optional parameter so
multiple calls
# can be made transactional, eg
#
# runt.next_times
inclusive_endpoint, ‘now’ => Time.now
# runt.next_times
inclusive_endpoint, :now => Time.now
#
that way it’s easy to do
loop{
now = Time.now
inclusive_endpoint = now + sleep_interval
runts.each do |runt|
times = runt.next_times inclusive_endpoint, :now => now
schedule_all_events times
end
sleep_until inclusive_endpoint
}
make sense?
thanks for a great lib btw!
-a