summaryrefslogtreecommitdiff
path: root/lib/rbot/timer.rb
diff options
context:
space:
mode:
authorTom Gilbert <tom@linuxbrit.co.uk>2005-08-27 14:16:42 +0000
committerTom Gilbert <tom@linuxbrit.co.uk>2005-08-27 14:16:42 +0000
commit6ad81c62702028559f2ccc2851842c871a2c79c4 (patch)
treece2f7f8f8a78617283899e2431fdccbcd7eb87ba /lib/rbot/timer.rb
parentc6425686430c97824de999151836854db7893eac (diff)
better setup for ping timeouts.
I need to work on the timer code, it's not currently possible to create a timer within a timer event, due to the thread stop/start thing
Diffstat (limited to 'lib/rbot/timer.rb')
-rw-r--r--lib/rbot/timer.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/rbot/timer.rb b/lib/rbot/timer.rb
index 64324b6a..03a4c91e 100644
--- a/lib/rbot/timer.rb
+++ b/lib/rbot/timer.rb
@@ -78,6 +78,7 @@ module Timer
#
# add an action to the timer
def add(period, data=nil, &func)
+ debug "adding timer, period #{period}"
@handle += 1
@timers[@handle] = Action.new(period, data, &func)
start_on_add
@@ -90,6 +91,7 @@ module Timer
#
# add an action to the timer which will be run just once, after +period+
def add_once(period, data=nil, &func)
+ debug "adding one-off timer, period #{period}"
@handle += 1
@timers[@handle] = Action.new(period, data, true, &func)
start_on_add
@@ -135,6 +137,8 @@ module Timer
@next_action_time = timer.in
end
}
+ #debug "ticked. now #{@timers.length} timers remain"
+ #debug "next timer due at #{@next_action_time}"
end
# for backwards compat - this is a bit primitive