summaryrefslogtreecommitdiff
path: root/src/timespec.h
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@opera.com>2015-07-13 13:04:24 +0200
committerJoel Klinghed <the_jk@opera.com>2015-07-13 13:04:24 +0200
commit1d8af5a018282dc6a93b9ed7c87d9d2f87287b14 (patch)
treec47c19f7c27fd1774d1455b088eb207c611d30ed /src/timespec.h
parent59709e4cb30f2ff8666522d5b758731ab618adbc (diff)
Copy the dependencies from sawmill project
Diffstat (limited to 'src/timespec.h')
-rw-r--r--src/timespec.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/timespec.h b/src/timespec.h
new file mode 100644
index 0000000..2bf1182
--- /dev/null
+++ b/src/timespec.h
@@ -0,0 +1,26 @@
+/**
+ * \file timespec.h
+ * Declares timespec struct if platform is missing it
+ */
+
+#ifndef TIMESPEC_H
+#define TIMESPEC_H
+
+#include <time.h>
+#if !HAVE_STRUCT_TIMESPEC
+struct timespec
+{
+ time_t tv_sec;
+ long tv_nsec;
+};
+#endif
+
+NONULL void timespec_now(struct timespec *ts);
+
+NONULL void timespec_addms(struct timespec *ts, unsigned long ms);
+NONULL void timespec_add(struct timespec *ts, const struct timespec *add);
+
+NONULL int timespec_sub(struct timespec *ts, const struct timespec *sub);
+NONULL int timespec_cmp(const struct timespec *x, const struct timespec *y);
+
+#endif /* TIMESPEC_H */