summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2024-10-05 14:57:10 +0100
committerdakkar <dakkar@thenautilus.net>2024-10-05 14:57:10 +0100
commit003bd4703e25be2f5f21a1b9db046c99e2600efd (patch)
treebe4e03d796778983b51eeb2a6997792ff7027e8f
parentmaybe show time to full charge (diff)
downloadbattery-003bd4703e25be2f5f21a1b9db046c99e2600efd.tar.gz
battery-003bd4703e25be2f5f21a1b9db046c99e2600efd.tar.bz2
battery-003bd4703e25be2f5f21a1b9db046c99e2600efd.zip
simplify fraction
-rwxr-xr-xbattery6
1 files changed, 2 insertions, 4 deletions
diff --git a/battery b/battery
index bba03d1..d2d4ba5 100755
--- a/battery
+++ b/battery
@@ -56,13 +56,12 @@ sub update {
my $full = $bs->{energy_full} // $bs->{charge_full};
my $deriv = $bs->{power_now} // $bs->{current_now};
- my $e=$now/$full;
+ my $fraction = $now/$full;
my $charging = lc($bs->{status}) eq 'charging';
my $is_full = lc($bs->{status}) eq 'full';
my @symbols;
my $time_estimate='';
- my $percentage=sprintf '%.0f%%', 100*$e;
- my $fraction=$e;
+ my $percentage=sprintf '%.0f%%', 100*$fraction;
if ($deriv) {
my $t=( $charging ? $full - $now : $now )/$deriv;
@@ -71,7 +70,6 @@ sub update {
$time_estimate = sprintf "%s/%s",
_format_time($t),
_format_time($tot);
- $fraction= $now / $full;
}
if ($charging) {