summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-10-20 13:30:23 +0200
committerBastien Nocera <hadess@hadess.net>2013-10-20 13:30:23 +0200
commit498d4491edc154d41c1fc7659c263ed8128b4822 (patch)
tree46a47a92f5f03df4b1d0eeed9e6ce2d9b01f437f /src
parent21ecc70ccd4aee8bf25183837dc3276a4f51e934 (diff)
downloadupower-498d4491edc154d41c1fc7659c263ed8128b4822.tar.gz
daemon: Fix time to empty with multiple batteries
If one battery is draining and the other one isn't, the time to empty wouldn't be zero, but it would only match the time to empty for the single battery. Instead, ignore the accumulated time to empty/time to full for multiple batteries and recalculate it. https://bugzilla.gnome.org/show_bug.cgi?id=710344
Diffstat (limited to 'src')
-rw-r--r--src/up-daemon.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/up-daemon.c b/src/up-daemon.c
index cf42d13..ff9b8d2 100644
--- a/src/up-daemon.c
+++ b/src/up-daemon.c
@@ -282,9 +282,9 @@ up_daemon_update_display_battery (UpDaemon *daemon)
/* calculate a quick and dirty time remaining value */
if (energy_rate_total > 0) {
- if (state_total == UP_DEVICE_STATE_DISCHARGING && time_to_empty_total == 0)
+ if (state_total == UP_DEVICE_STATE_DISCHARGING)
time_to_empty_total = 3600 * (energy_total / energy_rate_total);
- else if (state_total == UP_DEVICE_STATE_CHARGING && time_to_full_total == 0)
+ else if (state_total == UP_DEVICE_STATE_CHARGING)
time_to_full_total = 3600 * ((energy_full_total - energy_total) / energy_rate_total);
}