RelativeTimes.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Christian Jacobi, February 13, 1992 4:03 pm PST
RelativeTimes: CEDAR DEFINITIONS ~
BEGIN
TimeStamp:
TYPE ~
RECORD [t:
CARD32];
t in milliseconds, relative to an arbitrary per-instance starting point.
nullTimeStamp: TimeStamp ~ [0];
for certain devices nullTimeStamp is not a legal TimeStamp
DeltaTime:
TYPE ~
INT32;
-- in milliseconds.
Period: PROC [from, to: TimeStamp] RETURNS [DeltaTime];
InlinePeriod:
PROC [from, to: TimeStamp]
RETURNS [DeltaTime] ~
INLINE {
The following line of code assumes that the maximum difference in time between "from" and "to" is less than LAST[INT32]. It relies on modular arithmetic.
RETURN [LOOPHOLE[to.t-from.t]]
};
IsLaterTime:
PROC [t1, t2: TimeStamp]
RETURNS [
BOOL];
returns t2 is later then t1
InlineIsLaterTime:
PROC [t1, t2: TimeStamp]
RETURNS [
BOOL] ~
INLINE {
RETURN [InlinePeriod[from: t1, to: t2] > 0]
};
END.