DIRECTORY Basics USING [DivMod, HighHalf, LowHalf], Process USING [Milliseconds, Ticks]; Intime: DEFINITIONS IMPORTS Basics = BEGIN MsTicks: TYPE = Process.Milliseconds; -- expressed in milliseconds MSTicks: TYPE = LONG CARDINAL; -- long milliseconds DeltaTicks: TYPE = Process.Ticks; DeltaTime: TYPE = DeltaTicks [0..256); maxDeltaTime: DeltaTime = LAST[DeltaTime]; msPerDeltaTick: MsTicks; deltaTicksPerSecond: DeltaTicks; DeltaDeltaTime: TYPE = DeltaTime [0..16); -- must fit in Action first word maxDeltaDeltaTime: DeltaDeltaTime = LAST[DeltaDeltaTime]; Overlap: TYPE = {loShort, hiShort}; EventTime: TYPE = MACHINE DEPENDENT RECORD [ SELECT OVERLAID Overlap FROM loShort => [lo: MsTicks, hi: LONG CARDINAL], hiShort => [lower: MSTicks, higher: CARDINAL], ENDCASE ]; ReadEventTime: PROC RETURNS [EventTime]; AdjustEventTime: PROC [initialize: BOOL _ FALSE]; BigDifference: PRIVATE PROC [t1, t2: LONG POINTER TO READONLY EventTime] RETURNS [MsTicks]; EventTimeDifference: PROC [t1, t2: LONG POINTER TO READONLY EventTime] RETURNS [MsTicks] = INLINE { RETURN[IF t1.hi = t2.hi THEN t1.lo - t2.lo ELSE BigDifference[t1, t2]] }; IsLaterTime: PROC [t1, t2: EventTime] RETURNS [BOOL] = INLINE { RETURN[IF t1.hi = t2.hi THEN t1.lo > t2.lo ELSE t1.hi > t2.hi] }; AddDeltaTimeToEventTime: PROC [eT: EventTime, dT: DeltaTime] RETURNS [rT: EventTime] = INLINE { lo: MSTicks _ LONG[eT.lo] + (dT*msPerDeltaTick); RETURN[[loShort[hi: eT.hi + Basics.HighHalf[lo], lo: Basics.LowHalf[lo]]]]; }; SubtractMsTicksFromEventTime: PROC [eT: LONG POINTER TO EventTime, ticks: MsTicks] = INLINE { IF ticks > eT.lower THEN eT.higher _ eT.higher - 1; eT.lower _ eT.lower - ticks; }; MsTicksToDeltaTime: PROC [s: MsTicks] RETURNS [dT: DeltaTicks, rem: MsTicks] = INLINE { [dT, rem] _ Basics.DivMod[s, msPerDeltaTick]; }; END. <Intime.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Dan Swinehart April 14, 1982 11:31 am Maureen Stone June 3, 1982 10:51 am Paul Rovner July 20, 1983 1:27 pm Doug Wyatt, April 14, 1985 8:20:24 pm PST grain of resolution for Increek events expresses time differences in tick units fits in a short event value cell milliseconds since 1901 DCS, July 2, 1980 2:39 PM, birth, extracted from Increeks July 2, 1980 2:56 PM, more July 17, 1980 3:17 PM, remove AddTimeToPosTime, involves Positions July 21, 1980 8:16 AM, add StoredTimeToEventTime August 7, 1980 9:35 AM, change EventTimeDifference to StoredEvent...ce, add EventTimeDiff..ce August 12, 1980 12:37 AM, change time representation again, all milliseconds August 12, 1980 4:23 PM, add SubtractMsTicksFromEventTime August 19, 1980 4:45 PM, difference operates on READONLYs September 9, 1980 2:57 PM, long pointers September 12, 1980 5:47 AM, modify DeltaTime a little October 2, 1980 3:36 PM, make EventTime internals PRIVATE 29-Jan-81 13:49:38, narrow DeltaDeltaTime to widen Action kind Κ7˜codešœ ™ Kšœ Οmœ1™™>——…—‘