aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-02-21 12:52:14 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2015-02-21 14:17:47 +0100
commit6d8008cdf81da869b548ee13586f343d58131e58 (patch)
treeb98c2c7e9d91a43fbf5880da7d99c08c82f8c267 /plugins
parent3d440817896bf73945b91282aeb23d864ca9fcf8 (diff)
downloadxK-6d8008cdf81da869b548ee13586f343d58131e58.tar.gz
xK-6d8008cdf81da869b548ee13586f343d58131e58.tar.xz
xK-6d8008cdf81da869b548ee13586f343d58131e58.zip
pomodoro: some tuning
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/pomodoro6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/pomodoro b/plugins/pomodoro
index b2ea820..bc05ad8 100755
--- a/plugins/pomodoro
+++ b/plugins/pomodoro
@@ -68,7 +68,7 @@ class EventLoop
else
timer.index = @timers.size
@timers.push timer
- heapify_up @timers.size - 1
+ heapify_up timer.index
end
end
@@ -126,7 +126,7 @@ private
def dispatch_timers
now = Time.new
- while not @timers.empty? and @timers[0].when < now do
+ while not @timers.empty? and @timers[0].when <= now do
@timers[0].callback.call
remove_timer_at 0
end
@@ -134,7 +134,7 @@ private
def nearest_timeout
return nil if @timers.empty?
- timeout = @timers[0].when - Time.new
+ timeout = @timers[0].until
if timeout < 0 then 0 else timeout end
end