From 52409fae3e4b8d16b68b61902fc09075cd97b75d Mon Sep 17 00:00:00 2001 From: Dominik Sliwa Date: Sun, 2 Jul 2017 16:41:37 +0200 Subject: Backports generated from 4.11 kernel Initial commit. Signed-off-by: Dominik Sliwa --- backport-include/linux/timekeeping.h | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 backport-include/linux/timekeeping.h (limited to 'backport-include/linux/timekeeping.h') diff --git a/backport-include/linux/timekeeping.h b/backport-include/linux/timekeeping.h new file mode 100644 index 0000000..b683d12 --- /dev/null +++ b/backport-include/linux/timekeeping.h @@ -0,0 +1,38 @@ +#ifndef __BACKPORT_TIMKEEPING_H +#define __BACKPORT_TIMKEEPING_H +#include +#include + +#if LINUX_VERSION_IS_GEQ(3,17,0) +#include_next +#endif + +#if LINUX_VERSION_IS_LESS(3,17,0) +#define ktime_get_ns LINUX_BACKPORT(ktime_get_ns) +extern ktime_t ktime_get(void); +#define ktime_get_ns LINUX_BACKPORT(ktime_get_ns) +static inline u64 ktime_get_ns(void) +{ + return ktime_to_ns(ktime_get()); +} + +extern ktime_t ktime_get_boottime(void); +#define ktime_get_boot_ns LINUX_BACKPORT(ktime_get_boot_ns) +static inline u64 ktime_get_boot_ns(void) +{ + return ktime_to_ns(ktime_get_boottime()); +} +#endif /* < 3.17 */ + +#if LINUX_VERSION_IS_LESS(3,19,0) +static inline time64_t ktime_get_seconds(void) +{ + struct timespec t; + + ktime_get_ts(&t); + + return t.tv_sec; +} +#endif + +#endif /* __BACKPORT_TIMKEEPING_H */ -- cgit v1.2.3