summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2008-11-17 12:36:17 +0000
committerDavid Cournapeau <cournape@gmail.com>2008-11-17 12:36:17 +0000
commit9feb5b07aae1c8ac434577abf9bf5c9038b70931 (patch)
treea561e61026fc2fe798e09d7bf6b8edf820c8c21d
parent40730e237a81678a7a645f9b69d45dce97a8a10f (diff)
downloadnumpy-9feb5b07aae1c8ac434577abf9bf5c9038b70931.tar.gz
Use a wrapper around _ftime to work around a mingw bug in msvc runtimes import libraries.
-rw-r--r--numpy/random/mtrand/randomkit.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/numpy/random/mtrand/randomkit.c b/numpy/random/mtrand/randomkit.c
index 6d93a9c01..900d6adb1 100644
--- a/numpy/random/mtrand/randomkit.c
+++ b/numpy/random/mtrand/randomkit.c
@@ -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_error rk_randomseed(rk_state *state)
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