A Time.T
represents a moment in time, reckoned as a number of
seconds since some epoch or starting point.
\index{time!of day}
\index{time!Time interface@{\tt Time} interface}
INTERFACETime ; TYPE T = LONGREAL; PROCEDURE Now(): T;
Return the current moment in time.
VAR (*CONST*) Grain: LONGREAL;
If a thread performst0 := Time.Now(); t1 := Time.Now()
, then eithert1 = t0
ort1 >= t0 + Time.Grain
.Grain
always lies in the half-open interval(0..1]
and is usually no larger than one sixtieth of a second.
END Time.There are a variety of timekeeping needs, and
Time.Now
may not
satisfy all of them. It is intended to be useful for recording times
and measuring intervals arising during the execution of computer
programs with a resolution comparable to human reaction times.
The epoch for a Time.T
varies from one operating system to
another. To determine the epoch, call Date.FromTime(0.0D0,
Date.UTC)
. Note that communicating a Time.T
between systems,
say via remote procedure call or pickles, is likely to be a bad
idea.
\index{epoch}
In many computers, Time.Now
is implemented with the technology
of an inexpensive wristwatch, and is therefore likely to suffer
from similar errors: the rate may vary, and the value may be changed
by a human operator.
The Thread
interface contains procedures that delay the execution
of the calling thread for a specified duration. The Tick
interface provides access to a clock with subsecond resolution.