From: Taylor R Campbell Date: Fri, 26 Oct 2018 16:15:28 +0000 (+0000) Subject: clock() returns (clock_t)-1 on error, not necessarily negative. X-Git-Tag: mit-scheme-pucked-10.1.2~16^2~158 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=b07626c9c53f7ea6a33205987e944606df7b9c8c;p=mit-scheme.git 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. --- 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)