Software / code / prosody
Comparison
plugins/mod_admin_shell.lua @ 10878:b37dc3776f69
mod_admin_shell: Fix error due to float passed to os.date in Lua 5.3
Thanks Martin
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 02 Jun 2020 16:40:23 +0200 |
| parent | 10863:455a151db834 |
| child | 10887:3debe04a6162 |
comparison
equal
deleted
inserted
replaced
| 10877:2b015ef8cd06 | 10878:b37dc3776f69 |
|---|---|
| 1271 local h, params = add_task.h, add_task.params; | 1271 local h, params = add_task.h, add_task.params; |
| 1272 if h then | 1272 if h then |
| 1273 print("-- util.timer"); | 1273 print("-- util.timer"); |
| 1274 for i, id in ipairs(h.ids) do | 1274 for i, id in ipairs(h.ids) do |
| 1275 if not params[id] then | 1275 if not params[id] then |
| 1276 print(os.date("%F %T", h.priorities[i]), h.items[id]); | 1276 print(os.date("%F %T", math.floor(h.priorities[i])), h.items[id]); |
| 1277 elseif not params[id].callback then | 1277 elseif not params[id].callback then |
| 1278 print(os.date("%F %T", h.priorities[i]), h.items[id], unpack(params[id])); | 1278 print(os.date("%F %T", math.floor(h.priorities[i])), h.items[id], unpack(params[id])); |
| 1279 else | 1279 else |
| 1280 print(os.date("%F %T", h.priorities[i]), params[id].callback, unpack(params[id])); | 1280 print(os.date("%F %T", math.floor(h.priorities[i])), params[id].callback, unpack(params[id])); |
| 1281 end | 1281 end |
| 1282 end | 1282 end |
| 1283 end | 1283 end |
| 1284 if server.event_base then | 1284 if server.event_base then |
| 1285 local count = 0; | 1285 local count = 0; |
| 1291 print(count .. " libevent callbacks"); | 1291 print(count .. " libevent callbacks"); |
| 1292 end | 1292 end |
| 1293 if h then | 1293 if h then |
| 1294 local next_time = h:peek(); | 1294 local next_time = h:peek(); |
| 1295 if next_time then | 1295 if next_time then |
| 1296 return true, os.date("Next event at %F %T (in %%.6fs)", next_time):format(next_time - time.now()); | 1296 return true, os.date("Next event at %F %T (in %%.6fs)", math.floor(next_time)):format(next_time - time.now()); |
| 1297 end | 1297 end |
| 1298 end | 1298 end |
| 1299 return true; | 1299 return true; |
| 1300 end | 1300 end |
| 1301 | 1301 |