baresip/baresip-2.0.1-time_h.patch
2022-03-28 22:36:08 +02:00

42 lines
1.3 KiB
Diff

From 17029c9bed0648570b5bb53dee3359899f13e93a Mon Sep 17 00:00:00 2001
From: Robert Scheck <robert@fedoraproject.org>
Date: Mon, 28 Mar 2022 22:20:13 +0200
Subject: [PATCH] Avoid undeclared 'CLOCK_REALTIME' on RHEL/CentOS 7 (fixes
#1781)
Build-time failure without this patch:
src/audio.c: In function 'rx_thread':
src/audio.c:746:3: warning: implicit declaration of function 'clock_gettime'; did you mean 'calc_ptime'? [-Wimplicit-function-declaration]
clock_gettime(CLOCK_REALTIME, &ts);
^~~~~~~~~~~~~
calc_ptime
src/audio.c:746:3: warning: nested extern declaration of 'clock_gettime' [-Wnested-externs]
src/audio.c:746:17: error: 'CLOCK_REALTIME' undeclared (first use in this function)
clock_gettime(CLOCK_REALTIME, &ts);
^~~~~~~~~~~~~~
---
src/audio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/audio.c b/src/audio.c
index 67af6f0e7..ce329778b 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -6,6 +6,7 @@
*/
#define _DEFAULT_SOURCE 1
#define _BSD_SOURCE 1
+#define _POSIX_C_SOURCE 199309L
#include <string.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
@@ -17,6 +18,7 @@
#if defined(HAVE_PTHREAD) && defined(WIN32)
#include <pthread_time.h> /* needs mingw-w64 winpthreads */
#endif
+#include <time.h>
#include <re.h>
#include <rem.h>
#include <baresip.h>