From 501c6013d4a59fae5d4368e9657c4885493db809 Mon Sep 17 00:00:00 2001 From: Jia Tan Date: Thu, 29 Dec 2022 01:15:27 +0800 Subject: [PATCH] liblzma: Includes sys/time.h conditionally in mythread Previously, was always included, even if mythread only used clock_gettime. is still needed even if clock_gettime is not used though because struct timespec is needed for mythread_condtime. --- src/common/mythread.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/mythread.h b/src/common/mythread.h index 9be90d4e..a0dced19 100644 --- a/src/common/mythread.h +++ b/src/common/mythread.h @@ -100,12 +100,18 @@ mythread_sigmask(int how, const sigset_t *restrict set, // Using pthreads // //////////////////// -#include #include #include #include #include +// If clock_gettime() isn't available, use gettimeofday() from +// as a fallback. gettimeofday() is in SUSv2 and thus is supported on all +// relevant POSIX systems. +#if !defined(HAVE_CLOCK_GETTIME) +# include +#endif + #define MYTHREAD_RET_TYPE void * #define MYTHREAD_RET_VALUE NULL