summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/kernel.h1
-rw-r--r--include/linux/sched.h10
-rw-r--r--include/linux/time64.h5
3 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e4ffa86..2233350 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -8,6 +8,7 @@
#include <limits.h>
#include <linux/bug.h>
+#include <linux/byteorder.h>
#include <linux/compiler.h>
#define IS_ENABLED(opt) 0
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0316f50..885cc56 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -141,4 +141,14 @@ static inline u64 ktime_get_seconds(void)
return ts.tv_sec;
}
+static inline struct timespec current_kernel_time(void)
+{
+ struct timespec ts;
+
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ return ts;
+}
+
+#define CURRENT_TIME (current_kernel_time())
+
#endif /* __TOOLS_LINUX_SCHED_H */
diff --git a/include/linux/time64.h b/include/linux/time64.h
index 9d8a3ef..2e1ad82 100644
--- a/include/linux/time64.h
+++ b/include/linux/time64.h
@@ -61,6 +61,11 @@ static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
# define ns_to_timespec64 ns_to_timespec
# define timespec64_add_ns timespec_add_ns
+static inline s64 timespec_to_ns(const struct timespec *ts)
+{
+ return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
+}
+
#else
static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)