IntervalTimer.mesa
Last edited by D. Swinehart, March 4, 1983 9:36 am
Last edited by L. Stewart, December 27, 1983 2:20 pm
DIRECTORY
BasicTime USING [GetClockPulses, Pulses, PulsesToMicroseconds];
IntervalTimer: CEDAR DEFINITIONS IMPORTS BasicTime = {
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 BasicTime.
Machine independent timing:
Microseconds: TYPE = LONG CARDINAL;
Now: PROCEDURE RETURNS[time: Microseconds] = INLINE {
RETURN [BasicTime.PulsesToMicroseconds[BasicTime.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 = BasicTime.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 [BasicTime.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;
}.
December 27, 1983 2:20 pm, Stewart, Cedar 5