From: notoria Date: Sun, 19 Apr 2020 20:43:13 +0000 (+0200) Subject: Thrown an error if T < 0 or T > 0xfffffffffffffbff in sleep(T) X-Git-Tag: v0.8.123~118^2~3 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=fb331d39a659ecf6187a77ade01ca64a65c5980f;p=scryer-prolog.git Thrown an error if T < 0 or T > 0xfffffffffffffbff in sleep(T) --- diff --git a/src/prolog/lib/time.pl b/src/prolog/lib/time.pl index 42438c62..d4e27f2e 100644 --- a/src/prolog/lib/time.pl +++ b/src/prolog/lib/time.pl @@ -16,7 +16,12 @@ 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),