summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/util.c b/util.c
index 0f3f6bc..9c7e1a3 100644
--- a/util.c
+++ b/util.c
@@ -4,6 +4,7 @@
#include <unistd.h>
#include <errno.h>
#include <assert.h>
+#include <sys/time.h>
#include "util.h"
@@ -69,3 +70,9 @@ ssize_t writeall(int fd, const void *data, size_t length) {
int maxi(int a, int b) {
return a > b ? a : b;
}
+
+int64_t gettimestamp(void) {
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return tv.tv_sec * 1000000LL + tv.tv_usec;
+}