Holy cow, I wrote a book!
A customer was writing a program that called
GetSystemPowerStatus and used the
The customer wanted to know whether a reported battery life
percentage of 38% really means that the remaining battery life is
between 37.5% and 38.5%.
Although the value is reported to 1%
the accuracy in practice is much worse.
Similarly, the BatteryLifeTime is reported in seconds,
but if your battery actually lasts exactly the amount of time predicted
by that field (and not a second longer or shorter),
it's almost certainly a fluke.
Even a stopped clock is right twice a day.
These battery levels
come from the hardware itself, so you are at the mercy
of whoever manufactured your motherboard.
Some laptops update the values at 1-second intervals;
others can take 5 seconds or more.
In practice, these hardware-reported values have been found not to
be particularly precise, and in odd cases have occasionally been spotted
behaving in strange ways, such as spiking briefly and then returning
to a sane value.
But if you use the values (as flaky as they might be),
you'll at least be in good company:
These are the same values that the Windows Battery Meter displays.
There's another interface for retrieving battery life information,
The values for this also come from the hardware,
but they are more unstable than the values returned by
GetSystemPowerStatus because the estimated
run time is an extrapolation based on the current battery load.
This makes it more sensitive to short-term fluctuations
in energy consumption,
creating the paradoxical situation where more accurate information
is actually less useful.