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 0cd696cee998..65dd85b2105e 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -77,6 +77,8 @@ extern struct timespec xtime; | |||
77 | extern struct timespec wall_to_monotonic; | 77 | extern struct timespec wall_to_monotonic; |
78 | extern seqlock_t xtime_lock; | 78 | extern seqlock_t xtime_lock; |
79 | 79 | ||
80 | void timekeeping_init(void); | ||
81 | |||
80 | static inline unsigned long get_seconds(void) | 82 | static inline unsigned long get_seconds(void) |
81 | { | 83 | { |
82 | return xtime.tv_sec; | 84 | return xtime.tv_sec; |
@@ -100,6 +102,7 @@ extern int do_getitimer(int which, struct itimerval *value); | |||
100 | extern void getnstimeofday(struct timespec *tv); | 102 | extern void getnstimeofday(struct timespec *tv); |
101 | 103 | ||
102 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); | 104 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); |
105 | extern int timekeeping_is_continuous(void); | ||
103 | 106 | ||
104 | /** | 107 | /** |
105 | * timespec_to_ns - Convert timespec to nanoseconds | 108 | * timespec_to_ns - Convert timespec to nanoseconds |
@@ -142,6 +145,20 @@ extern struct timespec ns_to_timespec(const s64 nsec); | |||
142 | */ | 145 | */ |
143 | extern struct timeval ns_to_timeval(const s64 nsec); | 146 | extern struct timeval ns_to_timeval(const s64 nsec); |
144 | 147 | ||
148 | /** | ||
149 | * timespec_add_ns - Adds nanoseconds to a timespec | ||
150 | * @a: pointer to timespec to be incremented | ||
151 | * @ns: unsigned nanoseconds value to be added | ||
152 | */ | ||
153 | static inline void timespec_add_ns(struct timespec *a, u64 ns) | ||
154 | { | ||
155 | ns += a->tv_nsec; | ||
156 | while(unlikely(ns >= NSEC_PER_SEC)) { | ||
157 | ns -= NSEC_PER_SEC; | ||
158 | a->tv_sec++; | ||
159 | } | ||
160 | a->tv_nsec = ns; | ||
161 | } | ||
145 | #endif /* __KERNEL__ */ | 162 | #endif /* __KERNEL__ */ |
146 | 163 | ||
147 | #define NFDBITS __NFDBITS | 164 | #define NFDBITS __NFDBITS |