Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Error Im getting.. in 'sleep' : time interval must be positive <Argument Error>
- def time_block
- start_time = Time.now
- yield
- data = Time.now - start_time
- #return Time.now - start_time
- return data.abs
- end
- def repeat_every(seconds)
- while true do
- # begin
- time = sleep( seconds - time_block { yield } ) # again ignoring time > seconds
- puts time
- #rescue
- #puts "Time interval was not positive"
- #end #begin
- end
- end
- repeat_every(8.0) do
- checkMail
- end
Advertisement
Add Comment
Please, Sign In to add comment