The Tick interface

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. time elapsed

elapsed time

time Tick interface Tick interface

INTERFACE Tick;

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 to s seconds, rounded to the nearest whole number, or raise Overflow if s is negative or the result would not be less than 2^Word.Size.

END Tick.

If t0 is a reading of the tick clock and t1 is another reading taken less than 2Word.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).