summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbattery6
1 files changed, 3 insertions, 3 deletions
diff --git a/battery b/battery
index 2633fef..bba03d1 100755
--- a/battery
+++ b/battery
@@ -64,14 +64,14 @@ sub update {
my $percentage=sprintf '%.0f%%', 100*$e;
my $fraction=$e;
- if ($deriv && !$charging) {
- my $t=$now/$deriv;
+ if ($deriv) {
+ my $t=( $charging ? $full - $now : $now )/$deriv;
my $tot=$full/$deriv;
$time_estimate = sprintf "%s/%s",
_format_time($t),
_format_time($tot);
- $fraction= $t/$tot;
+ $fraction= $now / $full;
}
if ($charging) {