9a031d2
--- a/misc.c
9a031d2
+++ b/misc.c
9a031d2
@@ -865,17 +865,24 @@ ms_to_timeval(struct timeval *tv, int ms
9a031d2
 time_t
9a031d2
 monotime(void)
9a031d2
 {
9a031d2
-#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
9a031d2
+#if defined(HAVE_CLOCK_GETTIME) && \
9a031d2
+    (defined(CLOCK_MONOTONIC) || defined(CLOCK_BOOTTIME))
9a031d2
 	struct timespec ts;
9a031d2
 	static int gettime_failed = 0;
9a031d2
 
9a031d2
 	if (!gettime_failed) {
9a031d2
+#if defined(CLOCK_BOOTTIME)
9a031d2
+		if (clock_gettime(CLOCK_BOOTTIME, &ts) == 0)
9a031d2
+			return (ts.tv_sec);
9a031d2
+#endif
9a031d2
+#if defined(CLOCK_MONOTONIC)
9a031d2
 		if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
9a031d2
 			return (ts.tv_sec);
9a031d2
+#endif
9a031d2
 		debug3("clock_gettime: %s", strerror(errno));
9a031d2
 		gettime_failed = 1;
9a031d2
 	}
9a031d2
-#endif
9a031d2
+#endif /* HAVE_CLOCK_GETTIME && (CLOCK_MONOTONIC || CLOCK_BOOTTIME */
9a031d2
 
9a031d2
 	return time(NULL);
9a031d2
 }