diff options
-rwxr-xr-x | battery | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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) { |