aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2022-12-29 01:10:53 +0800
committerJia Tan <jiat0218@gmail.com>2023-01-05 00:26:35 +0800
commit9e3cb514b5b95bd235dcdff3db4436f57444ee4f (patch)
tree28638a49752e60d16d877672869910d392d1e193 /src
parentTranslations: Add Ukrainian translations of man pages. (diff)
downloadxz-9e3cb514b5b95bd235dcdff3db4436f57444ee4f.tar.xz
Build: No longer require HAVE_DECL_CLOCK_MONOTONIC to always be set.
Previously, if threading was enabled HAVE_DECL_CLOCK_MONOTONIC would always be set to 0 or 1. However, this macro was needed in xz so if xz was not built with threading and HAVE_DECL_CLOCK_MONOTONIC was not defined but HAVE_CLOCK_GETTIME was, it caused a warning during build. Now, HAVE_DECL_CLOCK_MONOTONIC has been renamed to HAVE_CLOCK_MONOTONIC and will only be set if it is 1.
Diffstat (limited to 'src')
-rw-r--r--src/common/mythread.h4
-rw-r--r--src/xz/mytime.c5
2 files changed, 4 insertions, 5 deletions
diff --git a/src/common/mythread.h b/src/common/mythread.h
index 41382183..9be90d4e 100644
--- a/src/common/mythread.h
+++ b/src/common/mythread.h
@@ -219,8 +219,8 @@ static inline int
mythread_cond_init(mythread_cond *mycond)
{
#ifdef HAVE_CLOCK_GETTIME
- // NOTE: HAVE_DECL_CLOCK_MONOTONIC is always defined to 0 or 1.
-# if defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) && HAVE_DECL_CLOCK_MONOTONIC
+# if defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) && \
+ defined(HAVE_CLOCK_MONOTONIC)
struct timespec ts;
pthread_condattr_t condattr;
diff --git a/src/xz/mytime.c b/src/xz/mytime.c
index 70444001..a81c88af 100644
--- a/src/xz/mytime.c
+++ b/src/xz/mytime.c
@@ -12,7 +12,7 @@
#include "private.h"
-#if !(defined(HAVE_CLOCK_GETTIME) && HAVE_DECL_CLOCK_MONOTONIC)
+#if !(defined(HAVE_CLOCK_GETTIME) && defined(HAVE_CLOCK_MONOTONIC))
# include <sys/time.h>
#endif
@@ -28,8 +28,7 @@ static uint64_t next_flush;
static uint64_t
mytime_now(void)
{
- // NOTE: HAVE_DECL_CLOCK_MONOTONIC is always defined to 0 or 1.
-#if defined(HAVE_CLOCK_GETTIME) && HAVE_DECL_CLOCK_MONOTONIC
+#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_CLOCK_MONOTONIC)
// If CLOCK_MONOTONIC was available at compile time but for some
// reason isn't at runtime, fallback to CLOCK_REALTIME which
// according to POSIX is mandatory for all implementations.