diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-04-28 11:15:47 +0300 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-04-28 11:15:47 +0300 |
commit | b5916182650e289804c5acf2d97f0db351d5d081 (patch) | |
tree | c02cfd1d5d28183a735bf2ebc2951cdf39ef8b7d /src | |
parent | 24439b0ba094a590e837d7be362da0584103391a (diff) | |
download | gnutls-b5916182650e289804c5acf2d97f0db351d5d081.tar.gz |
Avoid linking the library on librt.
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); |