9front - general discussion about 9front
 help / color / mirror / Atom feed
From: umbraticus@prosimetrum.com
To: 9front@9front.org
Subject: [9front] aux/acpi divide error
Date: Thu, 15 Sep 2022 22:16:52 +1200	[thread overview]
Message-ID: <BC25C45758E047255291C9BFBBA90521@prosimetrum.com> (raw)

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{

             reply	other threads:[~2022-09-15 10:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15 10:16 umbraticus [this message]
2022-09-15 13:25 ` Sigrid Solveig Haflínudóttir

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BC25C45758E047255291C9BFBBA90521@prosimetrum.com \
    --to=umbraticus@prosimetrum.com \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).