diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/benchmark-cipher.c | 1 | ||||
-rw-r--r-- | src/benchmark.c | 5 | ||||
-rw-r--r-- | src/benchmark.h | 15 |
3 files changed, 14 insertions, 7 deletions
diff --git a/src/benchmark-cipher.c b/src/benchmark-cipher.c index 68573b687b..95e6806230 100644 --- a/src/benchmark-cipher.c +++ b/src/benchmark-cipher.c @@ -28,7 +28,6 @@ #include <gnutls/gnutls.h> #include <gnutls/crypto.h> #include <time.h> -#include "timespec.h" /* gnulib gettime */ #include "benchmark.h" static unsigned char data[64 * 1024]; diff --git a/src/benchmark.c b/src/benchmark.c index 5f41535c1a..6cc79e2404 100644 --- a/src/benchmark.c +++ b/src/benchmark.c @@ -26,11 +26,6 @@ #include <unistd.h> #include "benchmark.h" -#if defined(HAVE_CLOCK_GETTIME) -# undef gettime -# define gettime(x) clock_gettime(CLOCK_PROCESS_CPUTIME_ID, x) -#endif - #define BSECS 5 int benchmark_must_finish = 0; diff --git a/src/benchmark.h b/src/benchmark.h index 059b477b84..fbbc9c1d07 100644 --- a/src/benchmark.h +++ b/src/benchmark.h @@ -23,7 +23,20 @@ #if defined(_WIN32) # include <windows.h> #endif -#include "timespec.h" /* gnulib gettime */ + +#if defined(HAVE_CLOCK_GETTIME) +# undef gettime +# define gettime(x) clock_gettime(CLOCK_PROCESS_CPUTIME_ID, x) +#else +inline static void +gettime (struct timespec *ts) +{ +struct timeval tv; + gettimeofday (&tv, NULL); + ts->tv_sec = tv.tv_sec; + ts->tv_nsec = tv.tv_usec * 1000; +} +#endif typedef void (*sighandler_t)(int); |