net: sanitize time computation to avoid division by zero

This commit is contained in:
Adrian C. (anrxc) 2011-09-03 12:10:51 +02:00
parent 25b375bd6b
commit 059442d039
1 changed files with 1 additions and 1 deletions

View File

@ -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