Skip to content

Commit 29aff2b

Browse files
committed
fixes #1866 clock_gettime is not used on Android, even though available
1 parent a8a8bd4 commit 29aff2b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/platform/posix/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ if (NNG_PLATFORM_POSIX)
2929
nng_check_func(getrandom NNG_HAVE_GETRANDOM)
3030
nng_check_func(arc4random_buf NNG_HAVE_ARC4RANDOM)
3131

32-
nng_check_lib(rt clock_gettime NNG_HAVE_CLOCK_GETTIME)
32+
nng_check_func(clock_gettime NNG_HAVE_CLOCK_GETTIME_LIBC)
33+
if (NNG_HAVE_CLOCK_GETTIME_LIBC)
34+
nng_defines_if(NNG_HAVE_CLOCK_GETTIME_LIBC NNG_HAVE_CLOCK_GETTIME)
35+
else()
36+
nng_check_lib(rt clock_gettime NNG_HAVE_CLOCK_GETTIME)
37+
endif()
3338
nng_check_lib(pthread sem_wait NNG_HAVE_SEMAPHORE_PTHREAD)
3439
nng_check_lib(pthread pthread_atfork NNG_HAVE_PTHREAD_ATFORK_PTHREAD)
3540
nng_check_lib(pthread pthread_set_name_np NNG_HAVE_PTHREAD_SET_NAME_NP)

0 commit comments

Comments
 (0)