DIRECTORY
System USING [GetClockPulses, Microseconds, Pulses, PulsesToMicroseconds];
IntervalTimer:
CEDAR
DEFINITIONS IMPORTS System = {
Clients may deal in Microseconds or in Pulses, but are strongly discouraged from using both because the conversions from one to the other are not guaranteed to be invertible.
The conversion routines may be found in System.
Machine independent timing:
Microseconds: TYPE = System.Microseconds;
Now:
PROCEDURE
RETURNS[time: Microseconds] =
INLINE {
RETURN [System.PulsesToMicroseconds[System.GetClockPulses[]]];
};
WaitForExpirationTime:
PROCEDURE[time: Microseconds];
This process will run again as soon as possible after time has been reached, returning immediately if that time has already been reached.
WaitForExpirationInterval:
PROCEDURE[microseconds:
INT];
A convenience. Waits until something close to that many microseconds have elapsed.
Machine dependent timing:
Pulses:
TYPE = System.Pulses;
This is what is returned by ProcessorFace.GetClockPulses and by the RCLK instruction. Its resolution is defined by ProcessorFace.microsecondsPerHundredPulses.
NowInPulses:
PROCEDURE
RETURNS[time: Pulses] =
INLINE {
RETURN [System.GetClockPulses[]];
};
WaitForExpirationTimeInPulses:
PROCEDURE[time: Pulses];
This process will run again as soon as possible after time has been reached, returning immediately if that time has already been reached.
WaitForExpirationIntervalInPulses:
PROCEDURE[pulses:
INT];
A convenience. Waits until something close to that many pulses have elapsed.
TooManyWaiters: ERROR;
}.