util.timer: Always pass the current time to timer callbacks.
authorWaqas Hussain <waqas20@gmail.com>
Sat, 12 May 2012 21:46:54 +0500
changeset 4871 b2d177f2febc
parent 4870 ca39f9b4cc8e
child 4872 b2059452fb55
util.timer: Always pass the current time to timer callbacks.
util/timer.lua
--- a/util/timer.lua	Sat May 12 21:39:30 2012 +0500
+++ b/util/timer.lua	Sat May 12 21:46:54 2012 +0500
@@ -27,7 +27,7 @@
 		if delay >= current_time then
 			t_insert(new_data, {delay, callback});
 		else
-			local r = callback();
+			local r = callback(current_time);
 			if r and type(r) == "number" then
 				return _add_task(r, callback);
 			end
@@ -67,7 +67,7 @@
 	function _add_task(delay, callback)
 		local event_handle;
 		event_handle = event_base:addevent(nil, 0, function ()
-			local ret = callback();
+			local ret = callback(get_time());
 			if ret then
 				return 0, ret;
 			elseif event_handle then