BootTimeImpl.mesa
Copyright Ó 1988, 1991, 1992 by Xerox Corporation. All rights reserved.
Willie-s, July 24, 1992 3:40 pm PDT
DIRECTORY
BasicTime,
BootTime;
BootTimeImpl: CEDAR PROGRAM
IMPORTS BasicTime
EXPORTS BootTime
~ BEGIN
bootTimeComputed: BOOL ¬ FALSE;
bootTime: BasicTime.GMT ¬ BasicTime.nullGMT;
Get: PUBLIC PROC RETURNS [BasicTime.GMT] ~ {
IF NOT bootTimeComputed THEN {
enow: BasicTime.ExtendedGMT ~ BasicTime.ExtendedNow[];
ticksSinceBoot: CARD ~ GetTicksSinceBoot[];
msSinceBoot: CARD ~ TicksToMsec[ticksSinceBoot];
dms: INT ~ INT[enow.usecs/1000] - INT[msSinceBoot];
ds: INT ~ dms/1000;
bootTime ¬ enow.gmt.Update[ds];
bootTimeComputed ¬ TRUE
};
RETURN [bootTime]
};
GetTicksSinceBoot: PROC RETURNS [CARD]
= TRUSTED MACHINE CODE {"XR←TicksSinceBoot"};
TicksToMsec: PROC [CARD] RETURNS [CARD]
= TRUSTED MACHINE CODE {"XR←TicksToMsec"};
END.