diff options
author | Dominik Sliwa <dominik.sliwa@toradex.com> | 2017-11-21 12:59:41 +0000 |
---|---|---|
committer | Dominik Sliwa <dominik.sliwa@toradex.com> | 2017-12-22 09:40:23 +0000 |
commit | e34cb44ac7c08783b98a16eec70125e205e6eb12 (patch) | |
tree | 1101d23f1a73e5627ae187b07c7a0cf8826e10d1 /backport-include/linux/timekeeping.h |
initial commit
Generated againts 4.14 kernel source with
git backports 1d8cc151d365582b42be00af776270b834a7a37d
Diffstat (limited to 'backport-include/linux/timekeeping.h')
-rw-r--r-- | backport-include/linux/timekeeping.h | 38 |
1 files changed, 38 insertions, 0 deletions
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 <linux/version.h> +#include <linux/types.h> + +#if LINUX_VERSION_IS_GEQ(3,17,0) +#include_next <linux/timekeeping.h> +#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 */ |