glibc needs -lrt to get clock_gettime()

Reported by csosstudy
This commit is contained in:
Frank Denis 2013-02-28 19:13:07 -08:00
parent c6fa04725f
commit 37a1358b81
2 changed files with 3 additions and 1 deletions

View File

@ -153,6 +153,8 @@ AC_C_BIGENDIAN
dnl Checks for functions and headers dnl Checks for functions and headers
AC_CHECK_FUNC(clock_gettime, , [AC_CHECK_LIB(rt, clock_gettime)])
AC_CHECK_FUNCS([SecureZeroMemory]) AC_CHECK_FUNCS([SecureZeroMemory])
dnl Switches. dnl Switches.

View File

@ -7,7 +7,7 @@
long long nanoseconds(void) long long nanoseconds(void)
{ {
#ifdef CLOCK_REALTIME #if defined(CLOCK_REALTIME) && defined(HAVE_CLOCK_GETTIME)
struct timespec t; struct timespec t;
if (clock_gettime(CLOCK_REALTIME,&t) != 0) return -1; if (clock_gettime(CLOCK_REALTIME,&t) != 0) return -1;
return t.tv_sec * 1000000000LL + t.tv_nsec; return t.tv_sec * 1000000000LL + t.tv_nsec;