bat: another workaround for broken ACPI implementations

This commit is contained in:
Adrian C. (anrxc) 2011-11-19 02:20:08 +01:00
parent eeb27a2916
commit 350e9240ea
1 changed files with 3 additions and 2 deletions

View File

@ -73,8 +73,9 @@ local function worker(format, warg)
else else
return {state, percent, time} return {state, percent, time}
end end
local hoursleft = math.floor(timeleft) -- Calculate time (but work around broken BAT/ACPI implementations)
local minutesleft = math.floor((timeleft - hoursleft) * 60 ) local hoursleft = math.min(math.floor(timeleft), 0)
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