about summary refs log tree commit diff
path: root/include/time.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/time.h')
-rw-r--r--include/time.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/time.h b/include/time.h
index d93b16a781..1f6507ef5f 100644
--- a/include/time.h
+++ b/include/time.h
@@ -236,5 +236,13 @@ valid_timespec64_to_timeval (const struct __timespec64 ts64)
 
   return tv;
 }
+
+/* Check if a value is in the valid nanoseconds range. Return true if
+   it is, false otherwise.  */
+static inline bool
+valid_nanoseconds (__syscall_slong_t ns)
+{
+  return __glibc_likely (0 <= ns && ns < 1000000000);
+}
 #endif
 #endif