Merge pull request #1 from wtfcoder/master

Prevent negative numbers when chargining

This happens on some laptops such as Acer
This commit is contained in:
Mic92 2011-11-17 12:56:03 -08:00
commit 8f6232dbdb
1 changed files with 2 additions and 2 deletions

View File

@ -73,8 +73,8 @@ local function worker(format, warg)
else else
return {state, percent, time} return {state, percent, time}
end end
local hoursleft = math.floor(timeleft) local hoursleft = math.min(math.floor(timeleft), 0)
local minutesleft = math.floor((timeleft - hoursleft) * 60 ) local minutesleft = math.min(math.floor((timeleft - hoursleft) * 60 ), 0)
time = string.format("%02d:%02d", hoursleft, minutesleft) time = string.format("%02d:%02d", hoursleft, minutesleft)
end end