Description: patch to work with debian wheeze  fixing compilation error with older linux/glibc
     revert to CLOCK_MONOTONIC.
Author: PICCORO Lenz McKAY <mckaygerhard@gmail.com>
Last-Update: 2023-09-27

--- opendoas-6.8.2.orig/timestamp.c
+++ opendoas-6.8.2/timestamp.c
@@ -196,12 +196,17 @@ timestamp_path(char *buf, size_t len)
 	return 0;
 }
 
+
 int
 timestamp_set(int fd, int secs)
 {
 	struct timespec ts[2], timeout = { .tv_sec = secs, .tv_nsec = 0 };
 
+#if defined(CLOCK_BOOTTIME)
 	if (clock_gettime(CLOCK_BOOTTIME, &ts[0]) == -1 ||
+#else
+	if (clock_gettime(CLOCK_MONOTONIC, &ts[0]) == -1 ||
+#endif
 	    clock_gettime(CLOCK_REALTIME, &ts[1]) == -1)
 		return -1;
 
@@ -228,7 +233,11 @@ timestamp_check(int fd, int secs)
 	if (!timespecisset(&st.st_atim) || !timespecisset(&st.st_mtim))
 		return 0;
 
+#if defined(CLOCK_BOOTTIME)
 	if (clock_gettime(CLOCK_BOOTTIME, &ts[0]) == -1 ||
+#else
+	if (clock_gettime(CLOCK_MONOTONIC, &ts[0]) == -1 ||
+#endif
 	    clock_gettime(CLOCK_REALTIME, &ts[1]) == -1) {
 		warn("clock_gettime");
 		return 0;
