Some of the predicates below are designed to operate in a DCG where
the state represents a time as a number of seconds since a particular
epoch (see get_time/1). The enables the write of code in a sort
of temporal modal logic form, where predicates can implicitly get
at the current time (using get//1) or move to other times by
chaging the DCG state.
- now(-T:time)// is det
- Unifies T with the current real time as returned by get_time/1.
- wait// is semidet
- wait(+Pre:nonneg)// is semidet
- Waits (blocks) until the real world time catches up with the
current DCG time. If Pre is given, then wait//1 sleeps until
Pre seconds before the current DCG time.
- sleep_till(+T:time) is semidet
- Compares T with the current real time (get_time/1); if T is
in the past, then fail, otherwise, blocks until approximately
T. Accuracy of timing cannot be guaranteed.
- sync// is det
- Runs in time DCG and sets the current time to the current real time as returned
by now//1 and get_time/1.
- adv(+T:nonneg)// is det
- Advances current time by T seconds. Runs in time DCG.
- cue(+D:nonneg)// is det
- Sets the current DCG time to D seconds after current real time.
- cue(+D:nonneg, +Q:nonneg)// is det
- Sets the current DCG time to next multiple of Q at least
D seconds after current real time.
- run_cued(+DT:nonneg, +Q:nonneg, +Cmd:phrase((time,S)), ?S1:S, ?S2:S) is nondet
- run_cued(+DT:nonneg, +Cmd:phrase((time,S)), ?S1:S, ?S2:S) is nondet
- run_cued(+DT:nonneg, +Q:nonneg, +Cmd:phrase(time)) is nondet
- run_cued(+DT:nonneg, +Cmd:phrase(time)) is nondet
- Run command Cmd in DT seconds. Cmd must operate in (time,S) DCG and is called
with the current real time plus DT seconds. If Q is supplied, the time
passed to Cmd is quantised upwards in units of Q seconds.
Undocumented predicates
The following predicates are exported, but not or incorrectly documented.
- wait(Arg1, Arg2, Arg3)
- run_cued(Arg1, Arg2, Arg3, Arg4)
- run_cued(Arg1, Arg2)
- run_cued(Arg1, Arg2, Arg3)