Merge pull request #940 from facebook/gettime
fix #911 : changed detection macro for `clock_gettime()`
This commit is contained in:
commit
87ed94c800
@ -34,7 +34,7 @@ extern "C" {
|
|||||||
# include <unistd.h> /* chown, stat */
|
# include <unistd.h> /* chown, stat */
|
||||||
# include <utime.h> /* utime */
|
# include <utime.h> /* utime */
|
||||||
#endif
|
#endif
|
||||||
#include <time.h> /* time */
|
#include <time.h> /* clock_t, clock, CLOCKS_PER_SEC, nanosleep */
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "mem.h" /* U32, U64 */
|
#include "mem.h" /* U32, U64 */
|
||||||
|
|
||||||
@ -64,7 +64,6 @@ extern "C" {
|
|||||||
#elif PLATFORM_POSIX_VERSION >= 0 /* Unix-like operating system */
|
#elif PLATFORM_POSIX_VERSION >= 0 /* Unix-like operating system */
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <sys/resource.h> /* setpriority */
|
# include <sys/resource.h> /* setpriority */
|
||||||
# include <time.h> /* clock_t, nanosleep, clock, CLOCKS_PER_SEC */
|
|
||||||
# if defined(PRIO_PROCESS)
|
# if defined(PRIO_PROCESS)
|
||||||
# define SET_REALTIME_PRIORITY setpriority(PRIO_PROCESS, 0, -20)
|
# define SET_REALTIME_PRIORITY setpriority(PRIO_PROCESS, 0, -20)
|
||||||
# else
|
# else
|
||||||
@ -168,8 +167,7 @@ static int g_utilDisplayLevel;
|
|||||||
}
|
}
|
||||||
return ((clockEnd - clockStart) * (U64)rate.numer) / ((U64)rate.denom);
|
return ((clockEnd - clockStart) * (U64)rate.numer) / ((U64)rate.denom);
|
||||||
}
|
}
|
||||||
#elif (PLATFORM_POSIX_VERSION >= 200112L)
|
#elif (PLATFORM_POSIX_VERSION >= 200112L) && (defined __UCLIBC__ || ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 17) || __GLIBC__ > 2))
|
||||||
#include <time.h>
|
|
||||||
#define UTIL_TIME_INITIALIZER { 0, 0 }
|
#define UTIL_TIME_INITIALIZER { 0, 0 }
|
||||||
typedef struct timespec UTIL_freq_t;
|
typedef struct timespec UTIL_freq_t;
|
||||||
typedef struct timespec UTIL_time_t;
|
typedef struct timespec UTIL_time_t;
|
||||||
|
Loading…
Reference in New Issue
Block a user