From fb331d39a659ecf6187a77ade01ca64a65c5980f Mon Sep 17 00:00:00 2001 From: notoria Date: Sun, 19 Apr 2020 22:43:13 +0200 Subject: [PATCH] Thrown an error if T < 0 or T > 0xfffffffffffffbff in sleep(T) --- src/prolog/lib/time.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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), -- 2.54.0