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