Commit 9a56c315 authored by Elizabeth Smith's avatar Elizabeth Smith Committed by Dave Watson

Use winpthreads clock_gettime implementations

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
parent 98f4bfaf
......@@ -48,6 +48,10 @@ int clock_getres(clockid_t clk_id, struct timespec* ts) {
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
......@@ -29,10 +29,16 @@
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_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment