Commit e0d9c1da authored by Erick Gallesio's avatar Erick Gallesio

Fixed two minor timer bugs signaled by Michael South

parent a4355815
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* *
* Author: Erick Gallesio [eg@essi.fr] * Author: Erick Gallesio [eg@essi.fr]
* Creation date: 2-Feb-2006 21:58 (eg) * Creation date: 2-Feb-2006 21:58 (eg)
* Last file update: 1-Feb-2007 17:20 (eg) * Last file update: 19-Nov-2007 11:10 (eg)
*/ */
#include <unistd.h> #include <unistd.h>
...@@ -216,7 +216,7 @@ DEFINE_PRIMITIVE("%mutex-unlock!", mutex_unlock, subr3, (SCM mtx, SCM cv, SCM tm ...@@ -216,7 +216,7 @@ DEFINE_PRIMITIVE("%mutex-unlock!", mutex_unlock, subr3, (SCM mtx, SCM cv, SCM tm
if (REALP(tm)) { if (REALP(tm)) {
tmd = REAL_VAL(tm); tmd = REAL_VAL(tm);
ts.tv_sec = (time_t) tmd; ts.tv_sec = (time_t) tmd;
ts.tv_nsec = (suseconds_t) ((tmd - ts.tv_sec) * 1000000); ts.tv_nsec = (suseconds_t) ((tmd - ts.tv_sec) * 1000000000);
} }
else if (!BOOLEANP(tm)) else if (!BOOLEANP(tm))
STk_error_bad_timeout(tm); STk_error_bad_timeout(tm);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* *
* Author: Erick Gallesio [eg@kaolin.unice.fr] * Author: Erick Gallesio [eg@kaolin.unice.fr]
* Creation date: 29-Mar-1994 10:57 * Creation date: 29-Mar-1994 10:57
* Last file update: 4-Jul-2007 11:07 (eg) * Last file update: 19-Nov-2007 11:19 (eg)
*/ */
#include <unistd.h> #include <unistd.h>
...@@ -852,8 +852,8 @@ DEFINE_PRIMITIVE("sleep", sleep, subr1, (SCM ms)) ...@@ -852,8 +852,8 @@ DEFINE_PRIMITIVE("sleep", sleep, subr1, (SCM ms))
if (n == LONG_MIN) if (n == LONG_MIN)
error_bad_int_or_out_of_bounds(ms); error_bad_int_or_out_of_bounds(ms);
ts.tv_sec = n / TIME_DIV_CONST; ts.tv_sec = n / 1000;
ts.tv_nsec = n % TIME_DIV_CONST; ts.tv_nsec = (n % 1000) * 1000000;
nanosleep(&ts, NULL); nanosleep(&ts, NULL);
return STk_void; return STk_void;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment