aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/time.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/time.h')
-rw-r--r--include/linux/time.h17
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;
80extern struct timespec wall_to_monotonic; 80extern struct timespec wall_to_monotonic;
81extern seqlock_t xtime_lock; 81extern seqlock_t xtime_lock;
82 82
83void timekeeping_init(void);
84
83static inline unsigned long get_seconds(void) 85static 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);
103extern void getnstimeofday(struct timespec *tv); 105extern void getnstimeofday(struct timespec *tv);
104 106
105extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 107extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
108extern 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 */
146extern struct timeval ns_to_timeval(const s64 nsec); 149extern 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 */
156static 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