Changeset

4871:b2d177f2febc

util.timer: Always pass the current time to timer callbacks.
author Waqas Hussain <waqas20@gmail.com>
date Sat, 12 May 2012 21:46:54 +0500
parents 4870:ca39f9b4cc8e
children 4872:b2059452fb55
files util/timer.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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