* [9front] aux/acpi divide error
@ 2022-09-15 10:16 umbraticus
2022-09-15 13:25 ` Sigrid Solveig Haflínudóttir
0 siblings, 1 reply; 2+ messages in thread
From: umbraticus @ 2022-09-15 10:16 UTC (permalink / raw)
To: 9front
I got a divide error after recent change.
I guess something like this should fix it:
diff e02e1188e472c7e2f40fa84e839631cc54f505a0 uncommitted
--- a/sys/src/cmd/aux/acpi.c
+++ b/sys/src/cmd/aux/acpi.c
@@ -210,7 +210,7 @@
ss = st.capacity * 3600 / st.rate;
if(bats[n].fullcharge > 0){
x = st.capacity * 100 / bats[n].fullcharge;
- if(st.state & 2)
+ if(st.rate > 0 && (st.state & 2))
ss = (bats[n].fullcharge - st.capacity) * 3600 / st.rate;
}
}else{
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [9front] aux/acpi divide error
2022-09-15 10:16 [9front] aux/acpi divide error umbraticus
@ 2022-09-15 13:25 ` Sigrid Solveig Haflínudóttir
0 siblings, 0 replies; 2+ messages in thread
From: Sigrid Solveig Haflínudóttir @ 2022-09-15 13:25 UTC (permalink / raw)
To: 9front
Quoth umbraticus@prosimetrum.com:
> I got a divide error after recent change.
> I guess something like this should fix it:
>
> diff e02e1188e472c7e2f40fa84e839631cc54f505a0 uncommitted
> --- a/sys/src/cmd/aux/acpi.c
> +++ b/sys/src/cmd/aux/acpi.c
> @@ -210,7 +210,7 @@
> ss = st.capacity * 3600 / st.rate;
> if(bats[n].fullcharge > 0){
> x = st.capacity * 100 / bats[n].fullcharge;
> - if(st.state & 2)
> + if(st.rate > 0 && (st.state & 2))
> ss = (bats[n].fullcharge - st.capacity) * 3600 / st.rate;
> }
> }else{
Oops. Thank you!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-15 13:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15 10:16 [9front] aux/acpi divide error umbraticus
2022-09-15 13:25 ` Sigrid Solveig Haflínudóttir
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).