From 6d8008cdf81da869b548ee13586f343d58131e58 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Sat, 21 Feb 2015 12:52:14 +0100
Subject: pomodoro: some tuning
---
plugins/pomodoro | 6 +++---
1 file 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
--
cgit v1.2.3-70-g09d2