summaryrefslogtreecommitdiff
path: root/src/benchmark.h
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-04-28 11:15:47 +0300
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-04-28 11:15:47 +0300
commitb5916182650e289804c5acf2d97f0db351d5d081 (patch)
treec02cfd1d5d28183a735bf2ebc2951cdf39ef8b7d /src/benchmark.h
parent24439b0ba094a590e837d7be362da0584103391a (diff)
downloadgnutls-b5916182650e289804c5acf2d97f0db351d5d081.tar.gz
Avoid linking the library on librt.
Diffstat (limited to 'src/benchmark.h')
-rw-r--r--src/benchmark.h15
1 files changed, 14 insertions, 1 deletions
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);