summaryrefslogtreecommitdiff
path: root/src/libstddjb
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb')
-rw-r--r--src/libstddjb/timespec_cmp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libstddjb/timespec_cmp.c b/src/libstddjb/timespec_cmp.c
new file mode 100644
index 0000000..85d23c2
--- /dev/null
+++ b/src/libstddjb/timespec_cmp.c
@@ -0,0 +1,13 @@
+/* ISC license. */
+
+#include <time.h>
+
+#include <skalibs/djbtime.h>
+
+int timespec_cmp (struct timespec const *a, struct timespec const *b)
+{
+ if (a->tv_sec < b->tv_sec) return -1 ;
+ if (a->tv_sec > b->tv_sec) return 1 ;
+ if (a->tv_nsec < b->tv_nsec) return -1 ;
+ return a->tv_nsec > b->tv_nsec ;
+}