[ Event Handling | Reference Manual | Alphabetic Index ]

event_after(+Event, +Time, -DueTime)

Set up an event Event which is triggered at DueTime, after Time seconds have elapsed
Atom or Handle
Positive number
Variable, will be bound to a float


The event Event is raised after Time seconds of elapsed time from when the predicate is executed. This is identical to event_after/2, except that DueTime gets bound to the time at which the event will be raised. This time can be compared to the the current event_time as returned by statistics/2.

For more details, see event_after/2.

Modes and Determinism


(5) type error
Event is neither an atom nor a handle or Time is not a positive number.


    % With the following the handler definition
    report_due(DueTime) :-
	 Remaining is DueTime - statistics(event_time),
	 printf("Event is due in %w seconds%n", [Remaining]).

    ?- event_create(abort, [], E1),
	event_after(E1, 5, Due),
	event_create(report_due(Due), [], E2),
	event_after_every(E2, 1),
	repeat, fail.
    Event is due in 3.98999999999999 seconds
    Event is due in 2.98 seconds
    Event is due in 1.97 seconds
    Event is due in 0.959999999999994 seconds
    Aborting execution ...

See Also

event_after / 2, event_after_every / 2, cancel_after_event / 2, events_after / 1, event / 1, set_event_handler / 2, current_after_events / 1, event_create / 3, event_retrieve / 3, get_flag / 2, statistics / 2