From 29aff2bacc9e2cfa6dcc52155d2816582617f918 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 7 Sep 2024 15:15:13 -0700 Subject: [PATCH] fixes #1866 clock_gettime is not used on Android, even though available --- src/platform/posix/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platform/posix/CMakeLists.txt b/src/platform/posix/CMakeLists.txt index 857c340a6..2212c8c86 100644 --- a/src/platform/posix/CMakeLists.txt +++ b/src/platform/posix/CMakeLists.txt @@ -29,7 +29,12 @@ if (NNG_PLATFORM_POSIX) nng_check_func(getrandom NNG_HAVE_GETRANDOM) nng_check_func(arc4random_buf NNG_HAVE_ARC4RANDOM) - nng_check_lib(rt clock_gettime NNG_HAVE_CLOCK_GETTIME) + nng_check_func(clock_gettime NNG_HAVE_CLOCK_GETTIME_LIBC) + if (NNG_HAVE_CLOCK_GETTIME_LIBC) + nng_defines_if(NNG_HAVE_CLOCK_GETTIME_LIBC NNG_HAVE_CLOCK_GETTIME) + else() + nng_check_lib(rt clock_gettime NNG_HAVE_CLOCK_GETTIME) + endif() nng_check_lib(pthread sem_wait NNG_HAVE_SEMAPHORE_PTHREAD) nng_check_lib(pthread pthread_atfork NNG_HAVE_PTHREAD_ATFORK_PTHREAD) nng_check_lib(pthread pthread_set_name_np NNG_HAVE_PTHREAD_SET_NAME_NP)