From e49ec71992c161a45aff2b3993b6f2d29e177c29 Mon Sep 17 00:00:00 2001 From: "F. Duncanh" Date: Mon, 23 Jan 2023 08:23:04 -0500 Subject: [PATCH] remove use of obsolete gettimeofday --- lib/raop_ntp.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/raop_ntp.c b/lib/raop_ntp.c index 6fbbd5f..7d79284 100644 --- a/lib/raop_ntp.c +++ b/lib/raop_ntp.c @@ -22,7 +22,6 @@ #include #ifdef _WIN32 #define CAST (char *) -#include #else #define CAST #endif @@ -359,12 +358,10 @@ raop_ntp_thread(void *arg) } // Sleep for 3 seconds - struct timeval now; struct timespec wait_time; MUTEX_LOCK(raop_ntp->wait_mutex); - gettimeofday(&now, NULL); - wait_time.tv_sec = now.tv_sec + 3; - wait_time.tv_nsec = now.tv_usec * 1000; + clock_gettime(CLOCK_REALTIME, &wait_time); + wait_time.tv_sec += 3; pthread_cond_timedwait(&raop_ntp->wait_cond, &raop_ntp->wait_mutex, &wait_time); MUTEX_UNLOCK(raop_ntp->wait_mutex); }