From 003bd4703e25be2f5f21a1b9db046c99e2600efd Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 5 Oct 2024 14:57:10 +0100 Subject: simplify fraction --- battery | 6 ++---- 1 file 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) { -- cgit v1.2.3