diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | misc.c | 15 |
2 files changed, 14 insertions, 5 deletions
@@ -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 | ||
6 | 20130804 | 10 | 20130804 |
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 |
@@ -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 | |||
857 | time_t | 859 | time_t |
858 | monotime(void) | 860 | monotime(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 | ||
872 | void | 877 | void |