tests: mingw-w64-libraries/winpthreads/tests/t_nanosleep.c Use winpthreads' clock_gettime instead of non-standard getntptimeofday. Signed-off-by: Kirill Makurin <maiddaisuki@outlook.com> Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-libraries/winpthreads/tests/t_nanosleep.c b/mingw-w64-libraries/winpthreads/tests/t_nanosleep.c index 21c0ceb..c876dc7 100644 --- a/mingw-w64-libraries/winpthreads/tests/t_nanosleep.c +++ b/mingw-w64-libraries/winpthreads/tests/t_nanosleep.c
@@ -2,14 +2,13 @@ #include <stdio.h> #include <stdlib.h> #include <time.h> +#include "pthread_time.h" #include <windows.h> #define POW10_3 1000 #define POW10_6 1000000 -extern int __cdecl getntptimeofday(struct timespec *tp, struct timezone *tz); - __int64 timespec_diff_as_ms(struct timespec *__old, struct timespec *__new) { return (__new->tv_sec - __old->tv_sec) * POW10_3 @@ -74,9 +73,9 @@ int rc; struct timespec tp, tp2, request = { 1, 0 }, remain; - getntptimeofday(&tp, NULL); + clock_gettime(CLOCK_REALTIME, &tp); rc = nanosleep(&request, &remain); - getntptimeofday(&tp2, NULL); + clock_gettime(CLOCK_REALTIME, &tp2); if (rc != 0) { printf("remain: %d.%09d\n", (int) remain.tv_sec, (int) remain.tv_nsec);