diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-09-15 00:41:28 +0200 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-09-24 15:37:41 +0200 |
commit | 572aa161bbe07afe52bab47bbdf158f8a9e78143 (patch) | |
tree | f480987fe47f85cfbbceb16715707039a7fddac5 | |
parent | 7dc611585a68f6934c9f417869cfd53b830d9c17 (diff) | |
download | vicious-legacy-572aa161bbe07afe52bab47bbdf158f8a9e78143.tar.xz |
Entropy widget cleaned up
-rw-r--r-- | entropy.lua | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/entropy.lua b/entropy.lua index 1146a0e..97568cc 100644 --- a/entropy.lua +++ b/entropy.lua @@ -6,8 +6,7 @@ -- {{{ Grab environment local io = { open = io.open } local setmetatable = setmetatable -local math = { floor = math.floor } -local string = { format = string.format } +local math = { ceil = math.ceil } -- }}} @@ -17,8 +16,7 @@ module("vicious.entropy") -- {{{ Entropy widget type local function worker(format, poolsize) - -- Don't waste time opening the poolsize, Linux 2.6 has a default - -- entropy pool of 4096-bits, if needed specify otherwise + -- Linux 2.6 has a default entropy pool of 4096-bits if poolsize == nil then poolsize = 4096 end -- Get available entropy @@ -27,9 +25,7 @@ local function worker(format, poolsize) f:close() -- Calculate percentage - ent_avail_percent = math.floor(ent_avail * 100 / poolsize) - -- This data is intended for a progressbar - ent_avail_percent = string.format("%0d", ent_avail_percent) + ent_avail_percent = math.ceil(ent_avail * 100 / poolsize) return {ent_avail, ent_avail_percent} end |