[Numpy-svn] r6069 - trunk/numpy/random/mtrand

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Nov 17 07:36:30 EST 2008


Author: cdavid
Date: 2008-11-17 06:36:17 -0600 (Mon, 17 Nov 2008)
New Revision: 6069

Modified:
   trunk/numpy/random/mtrand/randomkit.c
Log:
Use a wrapper around _ftime to work around a mingw bug in msvc runtimes import libraries.

Modified: trunk/numpy/random/mtrand/randomkit.c
===================================================================
--- trunk/numpy/random/mtrand/randomkit.c	2008-11-17 12:35:43 UTC (rev 6068)
+++ trunk/numpy/random/mtrand/randomkit.c	2008-11-17 12:36:17 UTC (rev 6069)
@@ -76,6 +76,15 @@
 #ifdef _WIN32
 /* Windows */
 #include <time.h>
+#ifdef NPY_NEEDS_MINGW_TIME_WORKAROUND
+/* mingw msvcr lib import wrongly export _ftime, which does not exist in the
+ * actual msvc runtime for version >= 8; we make it an alist to _ftime64, which
+ * is available in those versions of the runtime and should be ABI compatible
+ */
+#define _FTIME(x) _ftime64((x))
+#else
+#define _FTIME(x) _ftime((x))
+#endif
 #include <sys/timeb.h>
 #ifndef RK_NO_WINCRYPT
 /* Windows crypto */
@@ -169,7 +178,7 @@
 	rk_seed(rk_hash(getpid()) ^ rk_hash(tv.tv_sec) ^ rk_hash(tv.tv_usec)
 		^ rk_hash(clock()), state);
 #else
-	_ftime(&tv);
+	_FTIME(&tv);
 	rk_seed(rk_hash(tv.time) ^ rk_hash(tv.millitm) ^ rk_hash(clock()), state);
 #endif
 




More information about the Numpy-svn mailing list