diff options
Diffstat (limited to 'include/linux/time.h')
-rw-r--r-- | include/linux/time.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/time.h b/include/linux/time.h index 2fa2987c9a07..c05f8bb9a323 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -80,6 +80,8 @@ extern struct timespec xtime; | |||
80 | extern struct timespec wall_to_monotonic; | 80 | extern struct timespec wall_to_monotonic; |
81 | extern seqlock_t xtime_lock; | 81 | extern seqlock_t xtime_lock; |
82 | 82 | ||
83 | void timekeeping_init(void); | ||
84 | |||
83 | static inline unsigned long get_seconds(void) | 85 | static inline unsigned long get_seconds(void) |
84 | { | 86 | { |
85 | return xtime.tv_sec; | 87 | return xtime.tv_sec; |
@@ -103,6 +105,7 @@ extern int do_getitimer(int which, struct itimerval *value); | |||
103 | extern void getnstimeofday(struct timespec *tv); | 105 | extern void getnstimeofday(struct timespec *tv); |
104 | 106 | ||
105 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); | 107 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); |
108 | extern int timekeeping_is_continuous(void); | ||
106 | 109 | ||
107 | /** | 110 | /** |
108 | * timespec_to_ns - Convert timespec to nanoseconds | 111 | * timespec_to_ns - Convert timespec to nanoseconds |
@@ -145,6 +148,20 @@ extern struct timespec ns_to_timespec(const s64 nsec); | |||
145 | */ | 148 | */ |
146 | extern struct timeval ns_to_timeval(const s64 nsec); | 149 | extern struct timeval ns_to_timeval(const s64 nsec); |
147 | 150 | ||
151 | /** | ||
152 | * timespec_add_ns - Adds nanoseconds to a timespec | ||
153 | * @a: pointer to timespec to be incremented | ||
154 | * @ns: unsigned nanoseconds value to be added | ||
155 | */ | ||
156 | static inline void timespec_add_ns(struct timespec *a, u64 ns) | ||
157 | { | ||
158 | ns += a->tv_nsec; | ||
159 | while(unlikely(ns >= NSEC_PER_SEC)) { | ||
160 | ns -= NSEC_PER_SEC; | ||
161 | a->tv_sec++; | ||
162 | } | ||
163 | a->tv_nsec = ns; | ||
164 | } | ||
148 | #endif /* __KERNEL__ */ | 165 | #endif /* __KERNEL__ */ |
149 | 166 | ||
150 | #define NFDBITS __NFDBITS | 167 | #define NFDBITS __NFDBITS |