[mlpack-svn] r11994 - mlpack/trunk/src/mlpack/core/util
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Sun Mar 25 13:53:24 EDT 2012
Author: rcurtin
Date: 2012-03-25 13:53:23 -0400 (Sun, 25 Mar 2012)
New Revision: 11994
Modified:
mlpack/trunk/src/mlpack/core/util/timers.cpp
Log:
Define timersub() before it's used on Windows boxes. For some reason VS2010
didn't have a problem with that.
Modified: mlpack/trunk/src/mlpack/core/util/timers.cpp
===================================================================
--- mlpack/trunk/src/mlpack/core/util/timers.cpp 2012-03-25 17:25:36 UTC (rev 11993)
+++ mlpack/trunk/src/mlpack/core/util/timers.cpp 2012-03-25 17:53:23 UTC (rev 11994)
@@ -13,6 +13,20 @@
using namespace mlpack;
+// On Windows machines, we need to define timersub.
+#ifdef _WIN32
+inline void timersub(const timeval* tvp, const timeval* uvp, timeval* vvp)
+{
+ vvp->tv_sec = tvp->tv_sec - uvp->tv_sec;
+ vvp->tv_usec = tvp->tv_usec - uvp->tv_usec;
+ if (vvp->tv_usec < 0)
+ {
+ --vvp->tv_sec;
+ vvp->tv_usec += 1000000;
+ }
+}
+#endif
+
/**
* Start the given timer.
*/
@@ -147,17 +161,6 @@
tv->tv_sec = (long) (ptime / 1000000UL);
tv->tv_usec = (long) (ptime % 1000000UL);
}
-
-inline void timersub(const timeval* tvp, const timeval* uvp, timeval* vvp)
-{
- vvp->tv_sec = tvp->tv_sec - uvp->tv_sec;
- vvp->tv_usec = tvp->tv_usec - uvp->tv_usec;
- if (vvp->tv_usec < 0)
- {
- --vvp->tv_sec;
- vvp->tv_usec += 1000000;
- }
-}
#endif // _WIN32
void Timers::StopTimer(const std::string& timerName)
More information about the mlpack-svn
mailing list