Important: The information in this document is obsolete and should not be used for new development.
GetBatteryTimes
You can use theGetBatteryTimes
function 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
BatteryTimeRec
data type is described on page 6-28.DESCRIPTION
TheGetBatteryTimes
function returns information about the time remaining on the computer's battery or batteries. The time values are in seconds. The value oftheTimes.expectedBatteryTime
is 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
whichBattery
determines whetherGetBatteryTimes
returns the time information about a particular battery or the total time for all batteries. The value ofGetScaledBatteryInfo
should be in the range of 0 toBatteryCount()
. If the value ofwhichBattery
is 0,GetBatteryTimes
returns a total time for all the batteries, that is, the effective battery time for the whole system. If the value ofwhichBattery
is out of range, or the selected battery is not installed,GetBatteryTimes
will return a result of 0 in all fields. Here is a summary of the effects of thewhichBattery
parameter:
Value of whichBattery
Information 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 theTimes
ASSEMBLY-LANGUAGE INFORMATION
The trap is_PowerMgrDispatch
($A09E). The selector value forGetBatteryTimes
is 28 ($1C) in the low word of register D0. The pointer toBatteryTimeRec
is passed in register A0.