~ chicken-core (master) eda3186204d8e53d73d354eca2561fa9ae524534
commit eda3186204d8e53d73d354eca2561fa9ae524534
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Wed May 11 09:29:55 2011 -0400
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Wed May 11 09:29:55 2011 -0400
properly cast math in C_milliseconds to avoid integer overflow
diff --git a/runtime.c b/runtime.c
index d439aa59..7819051e 100644
--- a/runtime.c
+++ b/runtime.c
@@ -1656,7 +1656,7 @@ C_regparm double C_fcall C_milliseconds(void)
struct timeval tv;
if(C_gettimeofday(&tv, NULL) == -1) return 0;
- else return (tv.tv_sec - C_startup_time_seconds) * 1000 + tv.tv_usec / 1000;
+ else return ((double)tv.tv_sec - C_startup_time_seconds) * 1000.0 + tv.tv_usec / 1000;
#endif
}
Trap