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:13:38 +0200 |
commit | d81eed6d310bce28b3709980d80c433a04eefaae (patch) | |
tree | 3ab65939b04a86d22e39ad6a4a5ac3ab122257b8 /uptime.lua | |
parent | c2b68ad3e78e366e611600f54dcfa8d760ed026f (diff) | |
download | vicious-legacy-d81eed6d310bce28b3709980d80c433a04eefaae.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 -- }}} |