1/****************************************************************************
2 ****************************************************************************
3 ***
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.
9 ***
10 ****************************************************************************
11 ****************************************************************************/
12#ifndef _LINUX_KTIME_H
13#define _LINUX_KTIME_H
14
15#include <linux/time.h>
16#include <linux/jiffies.h>
17
18typedef union {
19 s64 tv64;
20#if BITS_PER_LONG != (64 && !defined(CONFIG_KTIME_SCALAR))
21 struct {
22#ifdef __BIG_ENDIAN
23 s32 sec, nsec;
24#else
25 s32 nsec, sec;
26#endif
27 } tv;
28#endif
29} ktime_t;
30
31#define KTIME_MAX ((s64)~((u64)1 << 63))
32#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
33
34#if BITS_PER_LONG == 64
35
36#if BITS_PER_LONG == 64
37#endif
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)
44#else
45
46#endif
47#define KTIME_REALTIME_RES (ktime_t){ .tv64 = TICK_NSEC }
48#define KTIME_MONOTONIC_RES (ktime_t){ .tv64 = TICK_NSEC }
49
50#define ktime_get_real_ts(ts) getnstimeofday(ts)
51
52#endif
53