-- ShowTime.Mesa
-- Russ Atkinson, August 26, 1982 6:10 pm

-- This module provides for timing at the system-provided high resolution
-- It doesn't really belong in Rigging, but why move it?

ShowTime: CEDAR DEFINITIONS = BEGIN

Microseconds: TYPE = LONG CARDINAL;

GetMark: PROC RETURNS [Microseconds];
-- returns the number of microseconds since an arbitrary event

SinceMark: PROC [from: Microseconds] RETURNS [Microseconds];
-- returns # of microseconds since the given mark

ShowDecimal: PROC [number: Microseconds,
p: PROC [CHAR] RETURNS [BOOL],
field: CARDINAL ← 0,
fill: CHAR ← ' ]
RETURNS [BOOL];
-- shows the long cardinal in decimal
-- will fill to fit field, but can be larger
-- will quit early if p returns TRUE

Show: PROC [from: Microseconds,
p: PROC [CHAR] RETURNS [BOOL],
places: CARDINAL ← 6];
-- shows the number of seconds since the given point
-- (in the form "NNN.MMMMMM") [NNN is > 0 chars, MMMMMM is 'places' chars]
-- quits early if p returns TRUE

ShowDelta: PROC [delta: Microseconds,
p: PROC [CHAR] RETURNS [BOOL],
places: CARDINAL ← 6];
-- shows the number of seconds in the given delta
-- (in the form "NNN.MMMMMM") [NNN is > 0 chars, MMMMMM is 'places' chars]
-- quits early if p returns TRUE

END.