Fixed timeout in Linux condition variable implementation
authorSam Lantinga <slouken@libsdl.org>
Fri, 23 Nov 2001 17:11:05 +0000
changeset 244 dc660aee7d7d
parent 243 cf4944faad96
child 245 ab781a7dd82f
Fixed timeout in Linux condition variable implementation
src/thread/linux/SDL_syscond.c
--- a/src/thread/linux/SDL_syscond.c	Thu Nov 22 06:34:25 2001 +0000
+++ b/src/thread/linux/SDL_syscond.c	Fri Nov 23 17:11:05 2001 +0000
@@ -137,10 +137,10 @@
 	gettimeofday(&delta, NULL);
 
 	abstime.tv_sec = delta.tv_sec + (ms/1000);
-	abstime.tv_nsec = (delta.tv_usec+(ms%1000)) * 1000;
-        if ( abstime.tv_nsec > 1000000 ) {
+	abstime.tv_nsec = (delta.tv_usec + (ms%1000) * 1000) * 1000;
+        if ( abstime.tv_nsec > 1000000000 ) {
           abstime.tv_sec += 1;
-          abstime.tv_nsec -= 1000000;
+          abstime.tv_nsec -= 1000000000;
         }
 
   tryagain: