[Ecls-list] patch to allow sub-second SLEEPing in mingw and MSVC

Larry Clapp larry at theclapp.org
Mon Jul 24 00:31:45 UTC 2006


diff -uwr ecls-cvs-2006.07.15.09.48.31/src/c/time.d ecls-cvs-2006.07.15.09.48.31-w32/src/c/time.d
--- ecls-cvs-2006.07.15.09.48.31/src/c/time.d   2006-05-29 04:51:21.000000000 -0400
+++ ecls-cvs-2006.07.15.09.48.31-w32/src/c/time.d       2006-07-23 20:26:26.770953600 -0400
@@ -29,9 +29,7 @@
 #include <ecl/internal.h>
 
 #if defined(mingw32) || defined(_MSC_VER)
-/* The function sleep() in MinGW is bogus: it counts millisecons! */
 #include <windows.h>
-#define sleep(x) Sleep(x*1000)
 #endif
 
 #ifndef HZ                     /* usually from <sys/param.h> */
@@ -79,6 +77,10 @@
        tm.tv_nsec = (long)((r - floor(r)) * 1e9);
        nanosleep(&tm, NULL);
 #else
+#  if defined(mingw32) || defined(_MSC_VER)
+       r = object_to_double(z) * 1000;
+       Sleep( (long) r );
+#  else
        z = round1(z);
        if (FIXNUMP(z))
                sleep(fix(z));
@@ -86,6 +88,7 @@
                for(;;)
                        sleep(1000);
 #endif
+#endif
        @(return Cnil)
 }
 





More information about the ecl-devel mailing list