From b07626c9c53f7ea6a33205987e944606df7b9c8c Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Fri, 26 Oct 2018 16:15:28 +0000 Subject: [PATCH] clock() returns (clock_t)-1 on error, not necessarily negative. If clock_t is unsigned, n < 0 is always false. Compare for equality with (clock_t)-1. --- src/microcode/prosenv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microcode/prosenv.c b/src/microcode/prosenv.c index f0d2ac04f..52cf4bb82 100644 --- a/src/microcode/prosenv.c +++ b/src/microcode/prosenv.c @@ -141,7 +141,7 @@ DEFINE_PRIMITIVE ("CURRENT-JIFFY", Prim_current_jiffy, 0, 0, 0) { PRIMITIVE_HEADER (0); clock_t n = (OS_current_jiffy ()); - PRIMITIVE_RETURN ((n < 0) ? SHARP_F : (intmax_to_integer (n))); + PRIMITIVE_RETURN ((n == (clock_t)-1) ? SHARP_F : (intmax_to_integer (n))); } DEFINE_PRIMITIVE ("JIFFIES-PER-SECOND", Prim_jiffies_per_second, 0, 0, 0) -- 2.25.1