1 /****************************************************************************
2 ****************************************************************************
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
10 ****************************************************************************
11 ****************************************************************************/
12 #ifndef _LINUX_KTIME_H
13 #define _LINUX_KTIME_H
15 #include <linux/time.h>
16 #include <linux/jiffies.h>
20 #if BITS_PER_LONG != (64 && !defined(CONFIG_KTIME_SCALAR))
31 #define KTIME_MAX ((s64)~((u64)1 << 63))
32 #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
34 #if BITS_PER_LONG == 64
36 #if BITS_PER_LONG == 64
38 #define ktime_sub(lhs, rhs) ({ (ktime_t){ .tv64 = (lhs).tv64 - (rhs).tv64 }; })
39 #define ktime_add(lhs, rhs) ({ (ktime_t){ .tv64 = (lhs).tv64 + (rhs).tv64 }; })
40 #define ktime_add_ns(kt, nsval) ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; })
41 #define ktime_to_timespec(kt) ns_to_timespec((kt).tv64)
42 #define ktime_to_timeval(kt) ns_to_timeval((kt).tv64)
43 #define ktime_to_ns(kt) ((kt).tv64)
47 #define KTIME_REALTIME_RES (ktime_t){ .tv64 = TICK_NSEC }
48 #define KTIME_MONOTONIC_RES (ktime_t){ .tv64 = TICK_NSEC }
50 #define ktime_get_real_ts(ts) getnstimeofday(ts)