summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2013-06-02 08:18:31 +1000
committerDarren Tucker <dtucker@zip.com.au>2013-06-02 08:18:31 +1000
commita710891659202c82545e84725d4e5cd77aef567c (patch)
treeedf409cfaafe861f0b208882481c2bf9f583008a
parentf60845fde29cead9d75e812db1c04916b4c58ffd (diff)
- (dtucker) [configure.ac misc.c] Look for clock_gettime in librt and fall
back to time(NULL) if we can't find it anywhere.
-rw-r--r--ChangeLog2
-rw-r--r--configure.ac7
-rw-r--r--misc.c4
3 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7f4323e07..50ce1b736 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -54,6 +54,8 @@
54 openbsd-compat/getrrsetbyname-ldns.c openbsd-compat/port-aix.c 54 openbsd-compat/getrrsetbyname-ldns.c openbsd-compat/port-aix.c
55 openbsd-compat/port-linux.c] Replace portable-specific instances of xfree 55 openbsd-compat/port-linux.c] Replace portable-specific instances of xfree
56 with the equivalent calls to free. 56 with the equivalent calls to free.
57 - (dtucker) [configure.ac misc.c] Look for clock_gettime in librt and fall
58 back to time(NULL) if we can't find it anywhere.
57 59
5820130529 6020130529
59 - (dtucker) [configure.ac openbsd-compat/bsd-misc.h] bz#2087: Add a null 61 - (dtucker) [configure.ac openbsd-compat/bsd-misc.h] bz#2087: Add a null
diff --git a/configure.ac b/configure.ac
index d35a19bcc..1b64d11ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
1# $Id: configure.ac,v 1.527 2013/06/01 21:18:48 dtucker Exp $ 1# $Id: configure.ac,v 1.528 2013/06/01 22:18:32 dtucker Exp $
2# 2#
3# Copyright (c) 1999-2004 Damien Miller 3# Copyright (c) 1999-2004 Damien Miller
4# 4#
@@ -15,7 +15,7 @@
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 16
17AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org]) 17AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
18AC_REVISION($Revision: 1.527 $) 18AC_REVISION($Revision: 1.528 $)
19AC_CONFIG_SRCDIR([ssh.c]) 19AC_CONFIG_SRCDIR([ssh.c])
20AC_LANG([C]) 20AC_LANG([C])
21 21
@@ -1648,6 +1648,9 @@ const char *gai_strerror(int);
1648AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1], 1648AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1649 [Some systems put nanosleep outside of libc])]) 1649 [Some systems put nanosleep outside of libc])])
1650 1650
1651AC_SEARCH_LIBS([clock_gettime], [rt],
1652 [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime])])
1653
1651dnl Make sure prototypes are defined for these before using them. 1654dnl Make sure prototypes are defined for these before using them.
1652AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])]) 1655AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1653AC_CHECK_DECL([strsep], 1656AC_CHECK_DECL([strsep],
diff --git a/misc.c b/misc.c
index cd45e9ecc..fd745444e 100644
--- a/misc.c
+++ b/misc.c
@@ -857,12 +857,16 @@ ms_to_timeval(struct timeval *tv, int ms)
857time_t 857time_t
858monotime(void) 858monotime(void)
859{ 859{
860#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
860 struct timespec ts; 861 struct timespec ts;
861 862
862 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) 863 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
863 fatal("clock_gettime: %s", strerror(errno)); 864 fatal("clock_gettime: %s", strerror(errno));
864 865
865 return (ts.tv_sec); 866 return (ts.tv_sec);
867#else
868 return time(NULL);
869#endif
866} 870}
867 871
868void 872void