From: Luke Bonham Date: Wed, 24 Aug 2016 15:14:06 +0000 (+0200) Subject: #162 comment 241640965: fix magnitude check when 100% on AC X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/0e37d220b793edbefb7064315cb7274fe5282862?hp=-c #162 comment 241640965: fix magnitude check when 100% on AC --- 0e37d220b793edbefb7064315cb7274fe5282862 diff --git a/widgets/bat.lua b/widgets/bat.lua index 9ab0cdc..d84a5d8 100644 --- a/widgets/bat.lua +++ b/widgets/bat.lua @@ -125,7 +125,7 @@ local function worker(args) rate_time = sum_energy_now / div end - if rate_time < 0.01 then -- check for magnitude discrepancies (#199) + if 0 < rate_time and rate_time < 0.01 then -- check for magnitude discrepancies (#199) rate_time_magnitude = math.abs(math.floor(math.log10(rate_time))) rate_time = rate_time * 10^(rate_time_magnitude - 2) end