aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-08-18 14:28:31 +0200
committerThomas White <taw@physics.org>2014-08-18 14:38:50 +0200
commit8e770f218c07cd71c3ba7262348c76ced477ba5b (patch)
treeebf9c4262e196297c64b5ecceb4101ec06dfebb1
parent30e5adcee376d20ae9cc622d2cf3675b3fac3c5b (diff)
gettimeofday() fixes
-rw-r--r--libcrystfel/src/dirax.c6
-rw-r--r--libcrystfel/src/grainspotter.c6
-rw-r--r--libcrystfel/src/mosflm.c6
-rw-r--r--libcrystfel/src/xds.c6
-rw-r--r--tests/gpu_sim_check.c8
5 files changed, 31 insertions, 1 deletions
diff --git a/libcrystfel/src/dirax.c b/libcrystfel/src/dirax.c
index ac12b57d..3ab592b6 100644
--- a/libcrystfel/src/dirax.c
+++ b/libcrystfel/src/dirax.c
@@ -42,6 +42,12 @@
#include <sys/ioctl.h>
#include <errno.h>
+#ifdef HAVE_CLOCK_GETTIME
+#include <time.h>
+#else
+#include <sys/time.h>
+#endif
+
#if HAVE_FORKPTY_LINUX
#include <pty.h>
#elif HAVE_FORKPTY_BSD
diff --git a/libcrystfel/src/grainspotter.c b/libcrystfel/src/grainspotter.c
index cebfb160..1ac31b6a 100644
--- a/libcrystfel/src/grainspotter.c
+++ b/libcrystfel/src/grainspotter.c
@@ -42,6 +42,12 @@
#include <sys/ioctl.h>
#include <errno.h>
+#ifdef HAVE_CLOCK_GETTIME
+#include <time.h>
+#else
+#include <sys/time.h>
+#endif
+
#if HAVE_FORKPTY_LINUX
#include <pty.h>
#elif HAVE_FORKPTY_BSD
diff --git a/libcrystfel/src/mosflm.c b/libcrystfel/src/mosflm.c
index 95b868bc..970e2fbd 100644
--- a/libcrystfel/src/mosflm.c
+++ b/libcrystfel/src/mosflm.c
@@ -69,6 +69,12 @@
#include <fcntl.h>
#include <errno.h>
+#ifdef HAVE_CLOCK_GETTIME
+#include <time.h>
+#else
+#include <sys/time.h>
+#endif
+
#if HAVE_FORKPTY_LINUX
#include <pty.h>
#elif HAVE_FORKPTY_BSD
diff --git a/libcrystfel/src/xds.c b/libcrystfel/src/xds.c
index 6162394c..8242bc96 100644
--- a/libcrystfel/src/xds.c
+++ b/libcrystfel/src/xds.c
@@ -44,6 +44,12 @@
#include <sys/ioctl.h>
#include <errno.h>
+#ifdef HAVE_CLOCK_GETTIME
+#include <time.h>
+#else
+#include <sys/time.h>
+#endif
+
#if HAVE_FORKPTY_LINUX
#include <pty.h>
#elif HAVE_FORKPTY_BSD
diff --git a/tests/gpu_sim_check.c b/tests/gpu_sim_check.c
index 0419d945..1526ac86 100644
--- a/tests/gpu_sim_check.c
+++ b/tests/gpu_sim_check.c
@@ -34,6 +34,12 @@
#include <stdlib.h>
#include <stdio.h>
+#ifdef HAVE_CLOCK_GETTIME
+#include <time.h>
+#else
+#include <sys/time.h>
+#endif
+
#include "../src/diffraction.h"
#include "../src/diffraction-gpu.h"
#include <detector.h>
@@ -61,7 +67,7 @@ static double get_hires_seconds()
{
struct timeval tp;
gettimeofday(&tp, NULL);
- return (double)tp.tv_sec + ((double)tp.tv_nsec/1e9);
+ return (double)tp.tv_sec + ((double)tp.tv_usec/1e6);
}
#endif