diff options
author | Landry Breuil <landry@rhaalovely.net> | 2012-01-04 12:52:25 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2012-01-06 13:40:50 +0000 |
commit | 7cd84658111b2c92d7684a13c4883d581fd513c3 (patch) | |
tree | 2aa6a37cad2c4a0045e0d26472ceda247f9a6f2f | |
parent | 3dfc0598f8ae99a44e3134359baeca8995247e0b (diff) |
openbsd: handle case where minutes_left might be negative
might not be useful since apm_fd is accessed through the singleton..
Signed-off-by: Richard Hughes <richard@hughsie.com>
-rw-r--r-- | src/openbsd/up-backend.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/openbsd/up-backend.c b/src/openbsd/up-backend.c index 4ff9c58..528f636 100644 --- a/src/openbsd/up-backend.c +++ b/src/openbsd/up-backend.c @@ -322,8 +322,8 @@ up_backend_update_battery_state(UpDevice* device) if (a.ac_state == APM_AC_ON) new_state = UP_DEVICE_STATE_CHARGING; - // zero out new_time_to empty if we're not discharging - new_time_to_empty = (new_state == UP_DEVICE_STATE_DISCHARGING ? a.minutes_left : 0); + // zero out new_time_to empty if we're not discharging or minutes_left is negative + new_time_to_empty = (new_state == UP_DEVICE_STATE_DISCHARGING && a.minutes_left > 0 ? a.minutes_left : 0); if (cur_state != new_state || percentage != (gdouble) a.battery_life || |