Summary:
No need to reinvent the wheel - winpthreads has the appropriate posix layer in place for time functionality
and we're already using it for pthreads on windows - so just include the right headers to make sure defines are set up when using time functionality
@override-unit-failures
Test Plan: fbconfig -r folly && fbmake runtests
Reviewed By: delong.j@fb.com
FB internal diff:
D1313600
return 0;
}
+#elif _MSC_VER
+// using winpthreads from mingw-w64
+// <pthreads_time.h> has clock_gettime and friends
+// make sure to include <pthread.h> as well for typedefs of timespec/etc
#else
#error No clock_gettime(2) compatibility wrapper available for this platform.
#endif
that do not support clock_gettime(2).
#endif
+/* For windows, we'll use pthread's time implementations */
+#ifdef _MSC_VER
+#include <pthread.h>
+#include <pthread_time.h>
+#else
typedef uint8_t clockid_t;
#define CLOCK_REALTIME 0
int clock_gettime(clockid_t clk_id, struct timespec* ts);
int clock_getres(clockid_t clk_id, struct timespec* ts);
+#endif
#endif /* FOLLY_DETAIL_CLOCK_H_ */