Section "timer"
With the introducing of the async API the Prolog interpreter is
able to process promises when in async mode. So far sleep/1 is the
first predicate that relinquishes control. Further opportunities
for the future will be input/output predicates. Last but not least
the frequent garbage collection can be used to relinquish control
on a regular basis.
The following async predicates are provided:
- sleep(T):
- The predicate suspends execution for T milliseconds.
- call_later(G, T):
- The built-in schedules the goal G to be executed after T
milliseconds.
- create_task(G):
- The built-in schedules the goal G to be executed.
- time_out(G, T):
- The predicate succeeds once if G succeeds. If the goal has not
terminated after T milli-seconds a time limit system error is
signalled to the goal.
- time(A):
- The predicate succeeds whenever the goal A succeeds. As a side
effect, timing of the call or redo is shown.
- atom_time(A, F, T):
- atom_time(A, F, T, L):
- If A is a variable, the built-in succeeds in A with the
millisecond time T formatted by the pattern F. Otherwise the
built-in succeeds in T with the millisecond time parsed from A
by the pattern F. The quaternary predicate allows specifying
time options. The following time field specifiers are supported:
- %a: Day of week as abbreviated text.
%b: Month as abbreviated text.
%Y: Year as a 4-digit decimal number.
- %m: Month as a 2-digit decimal number.
- %d: Day as a 2-digit decimal number.
- %H: Hour as a 2-digit decimal number.
- %M: Minute as a 2-digit decimal number.
- %S: Second as a 2-digit decimal number.
- %%: The percent sign (‘%’) as literal text.
The following time options are available:
face(F): The zone and language F, ‘local’ or ‘utc’.
Kommentare