local print = self.session.print;
local add_task = require"util.timer".add_task;
local h, params = add_task.h, add_task.params;
local print = self.session.print;
local add_task = require"util.timer".add_task;
local h, params = add_task.h, add_task.params;
- print("-- util.timer");
- for i, id in ipairs(h.ids) do
- if not params[id] then
- print(os.date("%F %T", h.priorities[i]), h.items[id]);
- elseif not params[id].callback then
- print(os.date("%F %T", h.priorities[i]), h.items[id], unpack(params[id]));
- else
- print(os.date("%F %T", h.priorities[i]), params[id].callback, unpack(params[id]));
+ if h then
+ print("-- util.timer");
+ for i, id in ipairs(h.ids) do
+ if not params[id] then
+ print(os.date("%F %T", h.priorities[i]), h.items[id]);
+ elseif not params[id].callback then
+ print(os.date("%F %T", h.priorities[i]), h.items[id], unpack(params[id]));
+ else
+ print(os.date("%F %T", h.priorities[i]), params[id].callback, unpack(params[id]));
+ end
end
end
if server.event_base then
local count = 0;
for k, v in pairs(debug.getregistry()) do
end
end
if server.event_base then
local count = 0;
for k, v in pairs(debug.getregistry()) do
- local next_time = h:peek();
- if next_time then
- return true, os.date("Next event at %F %T", next_time);
+ if h then
+ local next_time = h:peek();
+ if next_time then
+ return true, os.date("Next event at %F %T (in %%.6fs)", next_time):format(next_time - socket.gettime());
+ end