[mlpack-svn] r11995 - mlpack/trunk/src/mlpack/tests

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Sun Mar 25 13:58:30 EDT 2012


Author: rcurtin
Date: 2012-03-25 13:58:29 -0400 (Sun, 25 Mar 2012)
New Revision: 11995

Modified:
   mlpack/trunk/src/mlpack/tests/cli_test.cpp
Log:
Use Sleep() on Win32 systems.  This isn't tested yet -- but I'll do that in a
moment.


Modified: mlpack/trunk/src/mlpack/tests/cli_test.cpp
===================================================================
--- mlpack/trunk/src/mlpack/tests/cli_test.cpp	2012-03-25 17:53:23 UTC (rev 11994)
+++ mlpack/trunk/src/mlpack/tests/cli_test.cpp	2012-03-25 17:58:29 UTC (rev 11995)
@@ -11,6 +11,11 @@
   #include <sys/time.h>
 #endif
 
+// For Sleep().
+#ifdef _WIN32
+  #include <Windows.h>
+#endif
+
 #include <mlpack/core.hpp>
 
 #define DEFAULT_INT 42
@@ -209,7 +214,14 @@
 {
   Timer::Start("test_timer");
 
+  // On Windows (or, at least, in Windows not using VS2010) we cannot use
+  // usleep() because it is not provided.  Instead we will use Sleep() for a
+  // number of milliseconds.
+  #ifdef _WIN32
+  Sleep(10);
+  #else
   usleep(10000);
+  #endif
 
   Timer::Stop("test_timer");
 
@@ -218,7 +230,11 @@
   // Restart it.
   Timer::Start("test_timer");
 
+  #ifdef _WIN32
+  Sleep(10);
+  #else
   usleep(10000);
+  #endif
 
   Timer::Stop("test_timer");
 
@@ -227,7 +243,11 @@
   // Just one more time, for good measure...
   Timer::Start("test_timer");
 
+  #ifdef _WIN32
+  Sleep(20);
+  #else
   usleep(20000);
+  #endif
 
   Timer::Stop("test_timer");
 




More information about the mlpack-svn mailing list