[vlc-devel] [PATCH] timespec_get: fix sys/time.h include usage

Steve Lhomme robux4 at videolabs.io
Tue Oct 24 14:00:11 CEST 2017


If gettimeofday doesn't exist we shouldn't include it.
Matched the include used in vlc_fixups.h
---
 compat/timespec_get.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/compat/timespec_get.c b/compat/timespec_get.c
index 350e912fd0..24bc894cad 100644
--- a/compat/timespec_get.c
+++ b/compat/timespec_get.c
@@ -28,7 +28,9 @@
 #define _POSIX_TIMERS (-1)
 #endif
 #if (_POSIX_TIMERS <= 0)
-# include <sys/time.h> /* gettimeofday() */
+# ifdef HAVE_GETTIMEOFDAY
+#  include <sys/time.h> /* gettimeofday() */
+# endif
 #endif
 
 int timespec_get(struct timespec *ts, int base)
-- 
2.14.2



More information about the vlc-devel mailing list