From: Rajiv Abraham on
Hi Everyone,
I am creating an musical alarm clock e.g. play a youtube video at 5:30
am .
What I want is a Ruby Library\Gem where I can specify the time and I
will have a call back at that particular time or a synchronous method
which will wait until the set time is reached.

Any other ideas then above are also welcome.

I looked at the other posts in this forum ( and googling) and they are
all about timers, where you do something every n secs which is not
exactly what I want. I want to specify a particular time.

The closest I have is OpenWFEru from the good
article(http://www.igvita.com/2007/03/29/scheduling-tasks-in-ruby-rails/)

require 'openwfe/util/scheduler'
include OpenWFE

scheduler = Scheduler.new
scheduler.start

scheduler.schedule_in('3d2m10s') do
p 'after 3 days 2 minutes and 10 seconds stopping the scheduler and
exiting...'
scheduler.do_stop
# launch_music_video()
end

I appreciate the time you take out to answer this email.

Thanks,
Rajiv
--
Posted via http://www.ruby-forum.com/.

From: Brian Candler on
Rajiv Abraham wrote:
> or a synchronous method
> which will wait until the set time is reached.

That's just sleep().

require 'time'
secs = Time.parse("10pm") - Time.now
sleep secs
--
Posted via http://www.ruby-forum.com/.