From b3e31094ff4085d3e69d37963994500ade9cec39 Mon Sep 17 00:00:00 2001 From: notoria Date: Mon, 20 Apr 2020 11:27:28 +0200 Subject: [PATCH 1/2] Changed the error being thrown by sleep/1 --- src/prolog/lib/time.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/prolog/lib/time.pl b/src/prolog/lib/time.pl index b41d958a..4d9442a0 100644 --- a/src/prolog/lib/time.pl +++ b/src/prolog/lib/time.pl @@ -9,17 +9,19 @@ '$cpu_new' can be replaced by statistics/2 once that is implemented. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -:- module(time, [sleep/1, time/1]). +:- module(time, [max_sleep_time/1, sleep/1, time/1]). :- use_module(library(format)). :- use_module(library(iso_ext)). +max_sleep_time(0xfffffffffffffbff). + 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)) + ; max_sleep_time(N), T > N -> + throw(error(reprensentation_error(max_sleep_time), abolish/1)) ; '$sleep'(T) ). From 6d7612ead68efba82f698f1f70172fa3d1acd701 Mon Sep 17 00:00:00 2001 From: notoria Date: Mon, 20 Apr 2020 16:34:56 +0200 Subject: [PATCH 2/2] Corrected the error being thrown by sleep/1 --- src/prolog/lib/time.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/prolog/lib/time.pl b/src/prolog/lib/time.pl index 4d9442a0..2c2b67c1 100644 --- a/src/prolog/lib/time.pl +++ b/src/prolog/lib/time.pl @@ -19,9 +19,9 @@ max_sleep_time(0xfffffffffffffbff). sleep(T) :- builtins:must_be_number(T, sleep), ( T < 0 -> - throw(domain_error(not_less_than_zero, T)) + throw(error(domain_error(not_less_than_zero, T), sleep/1)) ; max_sleep_time(N), T > N -> - throw(error(reprensentation_error(max_sleep_time), abolish/1)) + throw(error(reprensentation_error(max_sleep_time), sleep/1)) ; '$sleep'(T) ).