configure: Fix clock_gettime() detection
authorBart Van Assche <bvanassche@acm.org>
Sun, 13 Nov 2022 23:09:22 +0000 (15:09 -0800)
committerBart Van Assche <bvanassche@acm.org>
Sun, 13 Nov 2022 23:19:56 +0000 (15:19 -0800)
Prevent that the clock_gettime() and CLOCK_MONOTONIC tests fail as follows:

error: argument 2 null where non-null expected [-Werror=nonnull]

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
configure

index 30bf5acbb024d729f39130396f115370632f99ff..60b58cd264c0082f8860e2344481e6fa542bd9eb 100755 (executable)
--- a/configure
+++ b/configure
@@ -1172,7 +1172,9 @@ cat > $TMPC << EOF
 #include <time.h>
 int main(int argc, char **argv)
 {
-  return clock_gettime(0, NULL);
+  struct timespec ts;
+
+  return clock_gettime(0, &ts);
 }
 EOF
 if compile_prog "" "" "clock_gettime"; then
@@ -1194,7 +1196,9 @@ if test "$clock_gettime" = "yes" ; then
 #include <time.h>
 int main(int argc, char **argv)
 {
-  return clock_gettime(CLOCK_MONOTONIC, NULL);
+  struct timespec ts;
+
+  return clock_gettime(CLOCK_MONOTONIC, &ts);
 }
 EOF
   if compile_prog "" "$LIBS" "clock monotonic"; then