diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2010-03-14 01:55:33 +0100 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2010-03-14 01:55:33 +0100 |
commit | 237470c8f45190b213e3a173ce6ae1a74b3e11fe (patch) | |
tree | 7f53c8144761947d4bde20715bcad34f4be0d6c0 /uptime.lua | |
parent | 9a82d4113a8271b7dfc7506f2b07379e3ede89a8 (diff) | |
download | vicious-legacy-237470c8f45190b213e3a173ce6ae1a74b3e11fe.tar.xz |
API: transform widgets namespace table to a directory
Diffstat (limited to 'uptime.lua')
-rw-r--r-- | uptime.lua | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/uptime.lua b/uptime.lua deleted file mode 100644 index fdf45ea..0000000 --- a/uptime.lua +++ /dev/null @@ -1,37 +0,0 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2010, Adrian C. <anrxc@sysphere.org> --- * (c) 2009, Lucas de Vries <lucas@glacicle.com> ---------------------------------------------------- - --- {{{ Grab environment -local setmetatable = setmetatable -local math = { floor = math.floor } -local string = { match = string.match } -local helpers = require("vicious.helpers") --- }}} - - --- Uptime: provides system uptime and load information -module("vicious.uptime") - - --- {{{ Uptime widget type -local function worker(format) - local proc = helpers.pathtotable("/proc") - - -- Get system uptime - local up_t = math.floor(string.match(proc.uptime, "[%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) - - -- Get load averages - local l1, l5, l15 = -- Get load averages for past 1, 5 and 15 minutes - string.match(proc.loadavg, "([%d]*%.[%d]*)%s([%d]*%.[%d]*)%s([%d]*%.[%d]*)") - - return {up_d, up_h, up_m, l1, l5, l15} -end --- }}} - -setmetatable(_M, { __call = function(_, ...) return worker(...) end }) |