Important: The information in this document is obsolete and should not be used for new development.
GetBatteryTimes
You can use theGetBatteryTimesfunction to find out about how much battery time remains.
void GetBatteryTimes (short whichBattery, BatteryTimeRec *theTimes);
whichBattery- The battery for which you want to know the time remaining. Specify 0 to get combined information about all the batteries.
- theTimes
- A pointer to a battery time structure, which contains information about the time remaining for the batteries. The
BatteryTimeRecdata type is described on page 6-28.DESCRIPTION
TheGetBatteryTimesfunction returns information about the time remaining on the computer's battery or batteries. The time values are in seconds. The value oftheTimes.expectedBatteryTimeis the estimated time remaining based on current use patterns. The values oftheTimes.minimumBatteryTime andtheTimes.maximumBatteryTime are worst-case and best-case estimates, respectively. The value oftheTimes.timeUntilCharged is the time that remains until the battery or batteries are fully charged.The value of
whichBatterydetermines whetherGetBatteryTimesreturns the time information about a particular battery or the total time for all batteries. The value ofGetScaledBatteryInfoshould be in the range of 0 toBatteryCount(). If the value ofwhichBatteryis 0,GetBatteryTimesreturns a total time for all the batteries, that is, the effective battery time for the whole system. If the value ofwhichBatteryis out of range, or the selected battery is not installed,GetBatteryTimeswill return a result of 0 in all fields. Here is a summary of the effects of thewhichBatteryparameter:
Value of whichBatteryInformation returned 0 Total battery time for all batteries From 1 to BatteryCount()Battery time for the selected battery Less than 0 or greater than BatteryCount()0 in all fields of theTimesASSEMBLY-LANGUAGE INFORMATION
The trap is_PowerMgrDispatch($A09E). The selector value forGetBatteryTimesis 28 ($1C) in the low word of register D0. The pointer toBatteryTimeRecis passed in register A0.