11.8. time: Real and virtual time.

Real and virtual time.

11.8.1. Rclock

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.

11.8.2. Rwait

site Rwait(Integer) :: Signal

Return a signal after the given number of milliseconds.

11.8.3. Rtime

site Rtime() :: Integer

Return the total number of milliseconds that have passed since this program began executing. Ranges from 0 to Long.MAX_VALUE.

11.8.4. metronome

def metronome(Integer) :: Signal

Publish a signal at regular intervals, indefinitely. The period is given by the argument, in milliseconds.

11.8.5. Vclock

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.

11.8.6. Vawait

site Vawait[A](A) :: Boolean

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.

11.8.7. Vtime

site Vtime[A]() :: A

Return the current virtual time. If none has been established or if called outside the scope of any clock, then halt silently.

The type A of the return value is determined by the type accepted by the time value comparator supplied to the Vclock call that created the current virtual clock.

11.8.8. IntegerTimeOrder

site IntegerTimeOrder(Integer, Integer) :: Integer

A time value comparator for integer time values. Pass this site to Vclock to create an integer virtual time scale.