Comparison

plugins/mod_admin_telnet.lua @ 10489:fabe50ea39f2

mod_admin_telnet: Avoid using LuaSocket for timestamps Using util.time will make it easier to move away from LuaSocket if we ever wanted to do that.
author Kim Alvefur <zash@zash.se>
date Sun, 08 Dec 2019 13:38:48 +0100
parent 10470:5267f12b038d
child 10504:1f80e5ad3cea
comparison
equal deleted inserted replaced
10488:03ff1e614b4d 10489:fabe50ea39f2
1263 end 1263 end
1264 return true, helpers.show_events(events_obj, event); 1264 return true, helpers.show_events(events_obj, event);
1265 end 1265 end
1266 1266
1267 function def_env.debug:timers() 1267 function def_env.debug:timers()
1268 local socket = require "socket";
1269 local print = self.session.print; 1268 local print = self.session.print;
1270 local add_task = require"util.timer".add_task; 1269 local add_task = require"util.timer".add_task;
1271 local h, params = add_task.h, add_task.params; 1270 local h, params = add_task.h, add_task.params;
1272 if h then 1271 if h then
1273 print("-- util.timer"); 1272 print("-- util.timer");
1291 print(count .. " libevent callbacks"); 1290 print(count .. " libevent callbacks");
1292 end 1291 end
1293 if h then 1292 if h then
1294 local next_time = h:peek(); 1293 local next_time = h:peek();
1295 if next_time then 1294 if next_time then
1296 return true, os.date("Next event at %F %T (in %%.6fs)", next_time):format(next_time - socket.gettime()); 1295 return true, os.date("Next event at %F %T (in %%.6fs)", next_time):format(next_time - time.now());
1297 end 1296 end
1298 end 1297 end
1299 return true; 1298 return true;
1300 end 1299 end
1301 1300