rcolebaugh / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone

Blame SOURCES/openssh-6.4p1-CLOCK_BOOTTIME.patch

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