getElapsedTimeSinceBoot: Honor times in suspend, too (#8983)

This commit is contained in:
zwim
2022-04-11 00:20:48 +02:00
committed by GitHub
parent 61cafab0e5
commit 0808560532
2 changed files with 6 additions and 4 deletions

View File

@@ -216,7 +216,8 @@ function BasePowerD:getCapacity()
if UIManager then
now_btv = UIManager:getElapsedTimeSinceBoot()
else
now_btv = TimeVal:now() + self.device.total_standby_tv -- Add time the device was in standby
-- Add time the device was in standby and suspend
now_btv = TimeVal:now() + self.device.total_standby_tv + self.device.total_suspend_tv
end
if (now_btv - self.last_capacity_pull_time):tonumber() >= 60 then
@@ -236,7 +237,8 @@ function BasePowerD:getAuxCapacity()
if UIManager then
now_btv = UIManager:getElapsedTimeSinceBoot()
else
now_btv = TimeVal:now() + self.device.total_standby_tv -- Add time the device was in standby
-- Add time the device was in standby and suspend
now_btv = TimeVal:now() + self.device.total_standby_tv + self.device.total_suspend_tv
end
if (now_btv - self.last_aux_capacity_pull_time):tonumber() >= 60 then

View File

@@ -1242,10 +1242,10 @@ function UIManager:getTime()
end
--[[--
Returns a TimeVal object corresponding to the last UI tick plus the time in standby.
Returns a TimeVal object corresponding to the last UI tick plus the time in standby and suspend.
]]
function UIManager:getElapsedTimeSinceBoot()
return self:getTime() + Device.total_standby_tv
return self:getTime() + Device.total_standby_tv + Device.total_suspend_tv
end
-- precedence of refresh modes: