util.sql: Create table with same charset as the charset we selected for our connectio...
[prosody.git] / util / timer.lua
index e52a69179497551c6d7b70cdfcc43e0bbe3dcdca..0e10e144e9746ed0f974be58605fb1fb43dc19ae 100644 (file)
@@ -1,7 +1,7 @@
 -- Prosody IM
 -- Copyright (C) 2008-2010 Matthew Wild
 -- Copyright (C) 2008-2010 Waqas Hussain
--- 
+--
 -- This project is MIT/X11 licensed. Please see the
 -- COPYING file in the source package for more information.
 --
@@ -27,7 +27,7 @@ if not server.event then
                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
@@ -42,7 +42,7 @@ if not server.event then
                        end
                        new_data = {};
                end
-               
+
                local next_time = math_huge;
                for i, d in pairs(data) do
                        local t, callback = d[1], d[2];
@@ -67,7 +67,7 @@ else
        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