diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-10-05 00:10:47 +0200 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-10-05 00:10:47 +0200 |
commit | 4602ca2fa5e8e2e408713f72ae7e4cd14480bc01 (patch) | |
tree | bfbf75b8afd738f5a036737404f3eafe87586c66 /uptime.lua | |
parent | af4e85f99d0ac63127f19640ef47d768d7bed7cd (diff) | |
download | vicious-legacy-4602ca2fa5e8e2e408713f72ae7e4cd14480bc01.tar.xz |
Lots of coding style changes
Diffstat (limited to 'uptime.lua')
-rw-r--r-- | uptime.lua | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -9,6 +9,7 @@ local tonumber = tonumber local io = { open = io.open } local setmetatable = setmetatable local math = { floor = math.floor } +local string = { match = string.match } -- }}} @@ -23,13 +24,13 @@ local function worker(format) local line = f:read("*line") f:close() - local total_uptime = math.floor(tonumber(line:match("[%d%.]+"))) - local uptime_days = math.floor(total_uptime / (3600 * 24)) - local uptime_hours = math.floor((total_uptime % (3600 * 24)) / 3600) - local uptime_minutes = math.floor(((total_uptime % (3600 * 24)) % 3600) / 60) - local uptime_seconds = math.floor(((total_uptime % (3600 * 24)) % 3600) % 60) + local up_t = math.floor(tonumber(string.match(line, "[%d%.]+"))) + local up_d = math.floor(up_t / (3600 * 24)) + local up_h = math.floor((up_t % (3600 * 24)) / 3600) + local up_m = math.floor(((up_t % (3600 * 24)) % 3600) / 60) + local up_s = math.floor(((up_t % (3600 * 24)) % 3600) % 60) - return {total_uptime, uptime_days, uptime_hours, uptime_minutes, uptime_seconds} + return {up_t, up_d, up_h, up_m, up_s} end -- }}} |