]> Repositorios git - scryer-prolog.git/commitdiff
Thrown an error if T < 0 or T > 0xfffffffffffffbff in sleep(T)
authornotoria <[email protected]>
Sun, 19 Apr 2020 20:43:13 +0000 (22:43 +0200)
committernotoria <[email protected]>
Sun, 19 Apr 2020 20:43:13 +0000 (22:43 +0200)
src/prolog/lib/time.pl

index 42438c6233f69146d3cf79c976599753b7823cad..d4e27f2ec866a054face0f10a7a8a069e237d399 100644 (file)
 
 sleep(T) :-
     builtins:must_be_number(T, sleep),
-    '$sleep'(T).
+    (   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),