From 849e998ac6c959429ee279a79ee1e5be5d9e7024 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 3 Aug 2004 23:31:22 +0000 Subject: It is possible to have struct timeval but not gettimeofday. svn:r2125 --- configure.in | 2 ++ src/common/util.c | 6 ++++++ src/common/util.h | 6 +----- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/configure.in b/configure.in index d04f5ce29..bdd43ed1f 100644 --- a/configure.in +++ b/configure.in @@ -148,6 +148,8 @@ AC_CHECK_HEADERS(stdint.h sys/types.h inttypes.h sys/param.h sys/wait.h sys/limi AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime) AC_REPLACE_FUNCS(strlcat strlcpy) +AC_CHECK_MEMBERS([struct timeval.tv_sec]) + dnl In case we aren't given a working stdint.h, we'll need to grow our own. dnl Watch out. diff --git a/src/common/util.c b/src/common/util.c index 5ccc58aed..42679a33b 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -31,6 +31,12 @@ #include #include #include +#ifndef HAVE_GETTIMEOFDAY +#ifdef HAVE_FTIME +#include +#endif +#endif + #include "util.h" #include "log.h" #include "crypto.h" diff --git a/src/common/util.h b/src/common/util.h index 0cc08e9a1..2d4702312 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -26,16 +26,12 @@ #elif defined(_MSC_VER) #include #endif -#ifndef HAVE_GETTIMEOFDAY -#ifdef HAVE_FTIME -#define USING_FAKE_TIMEVAL -#include +#ifndef HAVE_STRUCT_TIMEVAL_TV_SEC struct timeval { time_t tv_sec; unsigned int tv_usec; }; #endif -#endif #ifdef MS_WINDOWS /* Windows names string functions differently from most other platforms. */ -- cgit v1.2.3