Alarm Clock( )

R

Rajiv Abraham

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
 
B

Brian Candler

Rajiv said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top