projects
/
mit-scheme.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
57217bc
)
clock() returns (clock_t)-1 on error, not necessarily negative.
author
Taylor R Campbell
<campbell@mumble.net>
Fri, 26 Oct 2018 16:15:28 +0000
(16:15 +0000)
committer
Taylor R Campbell
<campbell@mumble.net>
Fri, 26 Oct 2018 16:30:12 +0000
(16:30 +0000)
If clock_t is unsigned, n < 0 is always false. Compare for equality
with (clock_t)-1.
src/microcode/prosenv.c
patch
|
blob
|
history
diff --git
a/src/microcode/prosenv.c
b/src/microcode/prosenv.c
index f0d2ac04f02c12b78f257a5bc2f224e013c53879..52cf4bb82fdb29d1460458f7bd9507b67a86ac56 100644
(file)
--- 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)