A Tick.T
represents a value of a clock with subsecond resolution.
The exact resolution differs from implementation to implementation
and is typically one sixtieth of a second or smaller.
\index{time!elapsed}
\index{elapsed time}
\index{time!Tick interface@{\tt Tick} interface}
INTERFACETick ; IMPORT Word; TYPE T = Word.T; PROCEDURE Now(): T;
Return the current reading of the tick clock.
PROCEDURE ToSeconds(t: Word.T): LONGREAL;
Return the number of seconds in t
ticks.
EXCEPTION Overflow; PROCEDURE FromSeconds(s: LONGREAL): Word.T RAISES {Overflow};
Return the number of ticks equivalent tos
seconds, rounded to the nearest whole number, or raiseOverflow
ifs
is negative or the result would not be less than2^Word.Size
.
END Tick.If
t0
is a reading of the tick clock and t1
is another reading
taken less than $\hbox2
^{\hboxWord.Size
}$ ticks after t0
,
then the number of ticks between t0
and t1
is Word.Minus(t1,
t0)
.
The values returned by Tick.Now()
and Time.Now()
typically
won't stay synchronized for long periods of time. The purpose of
Tick.Now()
is to provide accurate measurements of short
intervals. The purpose of Time.Now()
is to provide ``wall
clock'' time, preferably synchronized with UTC (coordinated
universal time).