aboutsummaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2011-09-03 12:10:51 +0200
committerAdrian C. (anrxc) <anrxc@sysphere.org>2011-09-03 12:10:51 +0200
commit059442d03931ad30f845d62b789885be7de5b79c (patch)
tree6b7d7f1ed565fd22451c6bfbb8cc5dcc188ccafd /widgets
parent25b375bd6b8ee5ceb04d09fca2d8ba413850d278 (diff)
downloadvicious-legacy-059442d03931ad30f845d62b789885be7de5b79c.tar.xz
net: sanitize time computation to avoid division by zero
Diffstat (limited to 'widgets')
-rw-r--r--widgets/net.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/widgets/net.lua b/widgets/net.lua
index 59ac52d..b8a270c 100644
--- a/widgets/net.lua
+++ b/widgets/net.lua
@@ -55,7 +55,7 @@ local function worker(format)
helpers.uformat(args, name .. " up", 0, unit)
else -- Net stats are absolute, substract our last reading
local interval = now - nets[name].time
- if interval < 0 then interval = 1 end
+ if interval <= 0 then interval = 1 end
local down = (recv - nets[name][1]) / interval
local up = (send - nets[name][2]) / interval