]> git.proxmox.com Git - mirror_spl.git/blobdiff - include/sys/time.h
Linux 5.0 compat: Fix timespec_sub()
[mirror_spl.git] / include / sys / time.h
index d2b20c8f63d54ebe999e681e3353e6754155c36c..461e7317d711cda291a33fad143fa99f5dc093da 100644 (file)
@@ -57,6 +57,17 @@ typedef struct timespec              timespec_t;
 
 static const int hz = HZ;
 
+/* 5.0 kernels no longer have timespec_sub(), only timespec64_sub() */
+#if !defined(HAVE_KERNEL_TIMESPEC_SUB) && defined(HAVE_INODE_TIMESPEC64_TIMES)
+static inline struct timespec timespec_sub(struct timespec a,
+    struct timespec b) {
+       struct timespec64 res;
+       res = timespec64_sub(timespec_to_timespec64(a),
+           timespec_to_timespec64(b));
+       return timespec64_to_timespec(res);
+}
+#endif
+
 #define        TIMESPEC_OVERFLOW(ts)           \
        ((ts)->tv_sec < TIME_MIN || (ts)->tv_sec > TIME_MAX)