Skip to content

Instantly share code, notes, and snippets.

@coderhs
Last active December 14, 2015 23:48
Show Gist options
  • Save coderhs/5167773 to your computer and use it in GitHub Desktop.
Save coderhs/5167773 to your computer and use it in GitHub Desktop.
Why my alarm stopped working.
class Alarm
def initialize(alarm_time,music = "/mount/data2/Songs/11.Mazhathullikal.mp3")
@alarm_time = alarm_time
@music = music
@run = true
end
def its_time
system("vlc #{@music} --volume 512")
end
def check_time
while @run
if Time.now >= @alarm_time
its_time
@run = false
end
sleep(@alarm_time-Time.now)
end
end
end
@alarm = Alarm.new Time.new 2013,03,15,6
@alarm.check_time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment