From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13233 invoked from network); 15 Sep 2022 10:18:10 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 15 Sep 2022 10:18:10 -0000 Received: from asquith.prosimetrum.com ([125.236.209.157]) by 9front; Thu Sep 15 06:16:47 -0400 2022 Message-ID: Date: Thu, 15 Sep 2022 22:16:52 +1200 From: umbraticus@prosimetrum.com To: 9front@9front.org MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: API table Subject: [9front] aux/acpi divide error Reply-To: 9front@9front.org Precedence: bulk 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{