trunk

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 ca39f9b4cc8e
children b2059452fb55
files util/timer.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/util/timer.lua	Sat May 12 21:39:30 2012 +0500
     1.2 +++ b/util/timer.lua	Sat May 12 21:46:54 2012 +0500
     1.3 @@ -27,7 +27,7 @@
     1.4  		if delay >= current_time then
     1.5  			t_insert(new_data, {delay, callback});
     1.6  		else
     1.7 -			local r = callback();
     1.8 +			local r = callback(current_time);
     1.9  			if r and type(r) == "number" then
    1.10  				return _add_task(r, callback);
    1.11  			end
    1.12 @@ -67,7 +67,7 @@
    1.13  	function _add_task(delay, callback)
    1.14  		local event_handle;
    1.15  		event_handle = event_base:addevent(nil, 0, function ()
    1.16 -			local ret = callback();
    1.17 +			local ret = callback(get_time());
    1.18  			if ret then
    1.19  				return 0, ret;
    1.20  			elseif event_handle then