Determine the time a full rechargable battery pack will last. DEC.19.2021 - UPDATED PROGRAM COMMENTS
The idea is that the computer will do some work (write to the screen, and look at the time, etc). Every minute it'll write what it knows to a file. If the power level gets low enough and causes the system to shutdown, then the last saved file will have all the data and the battery pack runtime length.
And a little blog post I wrote about this program and some battery packs I had converted to NiMH: http://blog.bradgrier.com/2021/12/24/how-long-will-a-nimh-battery-pack-last-in-a-nec-pc-8201-or-pc-8201a/