diff options
Diffstat (limited to 'include/linux/time.h')
-rw-r--r-- | include/linux/time.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/include/linux/time.h b/include/linux/time.h index 0cd696cee998..c05f8bb9a323 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -28,10 +28,13 @@ struct timezone { | |||
28 | #ifdef __KERNEL__ | 28 | #ifdef __KERNEL__ |
29 | 29 | ||
30 | /* Parameters used to convert the timespec values: */ | 30 | /* Parameters used to convert the timespec values: */ |
31 | #define MSEC_PER_SEC 1000L | 31 | #define MSEC_PER_SEC 1000L |
32 | #define USEC_PER_SEC 1000000L | 32 | #define USEC_PER_MSEC 1000L |
33 | #define NSEC_PER_SEC 1000000000L | 33 | #define NSEC_PER_USEC 1000L |
34 | #define NSEC_PER_USEC 1000L | 34 | #define NSEC_PER_MSEC 1000000L |
35 | #define USEC_PER_SEC 1000000L | ||
36 | #define NSEC_PER_SEC 1000000000L | ||
37 | #define FSEC_PER_SEC 1000000000000000L | ||
35 | 38 | ||
36 | static inline int timespec_equal(struct timespec *a, struct timespec *b) | 39 | static inline int timespec_equal(struct timespec *a, struct timespec *b) |
37 | { | 40 | { |
@@ -77,6 +80,8 @@ extern struct timespec xtime; | |||
77 | extern struct timespec wall_to_monotonic; | 80 | extern struct timespec wall_to_monotonic; |
78 | extern seqlock_t xtime_lock; | 81 | extern seqlock_t xtime_lock; |
79 | 82 | ||
83 | void timekeeping_init(void); | ||
84 | |||
80 | static inline unsigned long get_seconds(void) | 85 | static inline unsigned long get_seconds(void) |
81 | { | 86 | { |
82 | return xtime.tv_sec; | 87 | return xtime.tv_sec; |
@@ -100,6 +105,7 @@ extern int do_getitimer(int which, struct itimerval *value); | |||
100 | extern void getnstimeofday(struct timespec *tv); | 105 | extern void getnstimeofday(struct timespec *tv); |
101 | 106 | ||
102 | 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); | ||
103 | 109 | ||
104 | /** | 110 | /** |
105 | * timespec_to_ns - Convert timespec to nanoseconds | 111 | * timespec_to_ns - Convert timespec to nanoseconds |
@@ -142,6 +148,20 @@ extern struct timespec ns_to_timespec(const s64 nsec); | |||
142 | */ | 148 | */ |
143 | extern struct timeval ns_to_timeval(const s64 nsec); | 149 | extern struct timeval ns_to_timeval(const s64 nsec); |
144 | 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 | } | ||
145 | #endif /* __KERNEL__ */ | 165 | #endif /* __KERNEL__ */ |
146 | 166 | ||
147 | #define NFDBITS __NFDBITS | 167 | #define NFDBITS __NFDBITS |