Real and virtual time.
site Rclock() :: {. time :: (lambda () :: Integer), wait :: (lambda (Integer) :: Signal) .}
Create a new realtime clock instance.
rclock.wait(Integer) :: Signal
Return a signal after the given number of milliseconds.
rclock.time() :: Integer
Return the total number of milliseconds that have passed
since this clock was created.
Ranges from 0 to Long.MAX_VALUE
.
Return the total number of milliseconds that have passed
since this program began executing.
Ranges from 0 to Long.MAX_VALUE
.
def metronome(Integer) :: Signal
Publish a signal at regular intervals, indefinitely. The period is given by the argument, in milliseconds.
site Vclock(TotalSite) :: Signal
Create a new virtual clock instance, using the supplied site as a time value comparator.
The time value comparator site's type should be (A, A) :: Integer
, where A
is the
type of time values. The returned integer should be -1
, 0
, or 1
, depending on
whether argument one is less then, equal to, or greater than argument two, respectively.
Wait until the current virtual time is equal to the given value.
If the current time is presently the given value, return false
immediately.
If the given value is in the future, wait for it, and return true
.
If the given value is in the past, halt silently.
If no virtual time has been established, treat the given value as a future time.
If a call to Vawait
blocks, it becomes quiescent.
The type A
of the parameter is determined by the type accepted by the time value
comparator supplied to the Vclock
call that created the current virtual clock.