summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--misc.c15
2 files changed, 14 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 3ca13ebe8..2813200a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
2 - (dtucker) [regress/Makefile regress/test-exec.sh] Don't try to use test -nt 2 - (dtucker) [regress/Makefile regress/test-exec.sh] Don't try to use test -nt
3 since some platforms (eg really old FreeBSD) don't have it. Instead, 3 since some platforms (eg really old FreeBSD) don't have it. Instead,
4 run "make clean" before a complete regress run. ok djm. 4 run "make clean" before a complete regress run. ok djm.
5 - (dtucker) [misc.c] Fall back to time(2) at runtime if clock_gettime(
6 CLOCK_MONOTONIC...) fails. Some older versions of RHEL have the
7 CLOCK_MONOTONIC define but don't actually support it. Found and tested
8 by Kevin Brott, ok djm.
5 9
620130804 1020130804
7 - (dtucker) [auth-krb5.c configure.ac openbsd-compat/bsd-misc.h] Add support 11 - (dtucker) [auth-krb5.c configure.ac openbsd-compat/bsd-misc.h] Add support
diff --git a/misc.c b/misc.c
index 2bdfb6507..85c404218 100644
--- a/misc.c
+++ b/misc.c
@@ -854,19 +854,24 @@ ms_to_timeval(struct timeval *tv, int ms)
854 tv->tv_usec = (ms % 1000) * 1000; 854 tv->tv_usec = (ms % 1000) * 1000;
855} 855}
856 856
857#define clock_gettime(a,b) -1
858
857time_t 859time_t
858monotime(void) 860monotime(void)
859{ 861{
860#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) 862#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
861 struct timespec ts; 863 struct timespec ts;
864 static int gettime_failed = 0;
862 865
863 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) 866 if (!gettime_failed) {
864 fatal("clock_gettime: %s", strerror(errno)); 867 if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
868 return (ts.tv_sec);
869 debug3("clock_gettime: %s", strerror(errno));
870 gettime_failed = 1;
871 }
872#endif
865 873
866 return (ts.tv_sec);
867#else
868 return time(NULL); 874 return time(NULL);
869#endif
870} 875}
871 876
872void 877void