File clknetsim-glibc-2.31.patch of Package chrony.19115
From 6e4714b8b1730e865bf0066b898a7787e148eac9 Mon Sep 17 00:00:00 2001
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Tue, 19 Nov 2019 12:49:28 +0100
Subject: [PATCH] fix building with latest glibc headers
In current development glibc (pre 2.31) gettimeofday() no longer accepts
struct timezone.
---
Makefile | 3 +++
client.c | 8 +++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
--- Makefile.orig
+++ Makefile
@@ -2,9 +2,12 @@ CC ?= gcc
CXX ?= g++
CFLAGS += -O2 -Wall -g -fPIC
CXXFLAGS += $(CFLAGS)
+CPPFLAGS += $(apiflags)
all: clknetsim.so clknetsim
+apiflags := $(shell grep -q __timezone_ptr_t /usr/include/sys/time.h || echo -DGETTIMEOFDAY_VOID)
+
clientobjs = client.o
serverobjs = $(patsubst %.cc,%.o,$(wildcard *.cc))
--- client.c.orig
+++ client.c
@@ -561,7 +561,13 @@ static double timespec_to_time(const str
return tp->tv_sec + offset + tp->tv_nsec / 1e9;
}
-int gettimeofday(struct timeval *tv, struct timezone *tz) {
+int gettimeofday(struct timeval *tv,
+#if !defined(__GLIBC_PREREQ) || __GLIBC_PREREQ(2, 31) || defined(GETTIMEOFDAY_VOID)
+ void *tz
+#else
+ struct timezone *tz
+#endif
+ ) {
double time;
time = get_real_time() + 0.5e-6;