Callers wishing to specify a time relative to the present use the type Duration :
typedef long Duration;
Values of type Duration are 32 bits long. They are interpreted in a manner consistent with the Time Manager--positive values are in units of milliseconds, negative values are in units of microseconds. Therefore the value 1500 is 1500 milliseconds or 1.5 seconds while the value -8000 is 8000 microseconds or 8 milliseconds. Notice that many values can be expressed in two different ways. For example, 1000 and -1000000 both represent exactly one second. When two representations have equal value, they may be used interchangeably; neither is preferred or inherently more accurate.
Values of type Duration may express times as short as 1 microsecond or as long as 24 days. However, two values of type Duration are reserved and have special meaning. The value durationImmediate specifies no duration. The value durationForever, the largest positive 32-bit value, specifies that many milliseconds, or a very long time from the present.
The Driver Services Library provides the following definitions for use with values of type Duration :
enum
{
durationMicrosecond = -1,
durationMillisecond = 1,
durationSecond = 1000,
durationMinute = 1000 * 60,
durationHour = 1000 * 60 * 60,
durationDay = 1000 * 60 * 60 * 24,
durationForever = 0x7FFFFFFF,
durationImmediate = 0,
};
Another form for representing time is in Nanoseconds, the values of which are represented by unsigned 64-bit integers:
typedef struct Nanoseconds
{
unsigned long hi;
unsigned long lo;
} Nanoseconds;
A second data type, AbsoluteTime, is used to specify absolute times in system-defined units 64 bits long. As discussed in Time Base, the real duration of AbsoluteTime units must be calculated.
typedef struct AbsoluteTime
{
unsigned long hi;
unsigned long lo;
} AbsoluteTime;