Added the sleep predicate
:- use_module(library(format)).
:- use_module(library(iso_ext)).
+ sleep(T) :-
+ builtins:must_be_number(T, sleep),
+ ( T < 0 ->
+ throw(domain_error(not_less_than_zero, T))
+ ; T > 0xfffffffffffffbff ->
+ throw(domain_error(not_great_than_0xfffffffffffffbff, T))
+ ; '$sleep'(T)
+ ).
+
time(Goal) :-
'$cpu_now'(T0),
- Goal,
+ setup_call_cleanup(true,
+ ( Goal,
+ report_time(T0)
+ ),
+ report_time(T0)).
+
+report_time(T0) :-
'$cpu_now'(T),
Time is T - T0,
( bb_get('$first_answer', true) ->