diff options
author | john stultz <johnstul@us.ibm.com> | 2006-06-26 00:25:08 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 09:58:20 -0700 |
commit | cf3c769b4b0dd1146da84d5cf045dcfe53bd0f13 (patch) | |
tree | caeb91eff6538ed5910e673a40a9f2bd9a022afa /include/linux/time.h | |
parent | 5eb6d20533d14a432df714520939a6181e28f099 (diff) | |
download | kernel_samsung_tuna-cf3c769b4b0dd1146da84d5cf045dcfe53bd0f13.zip kernel_samsung_tuna-cf3c769b4b0dd1146da84d5cf045dcfe53bd0f13.tar.gz kernel_samsung_tuna-cf3c769b4b0dd1146da84d5cf045dcfe53bd0f13.tar.bz2 |
[PATCH] Time: Introduce arch generic time accessors
Introduces clocksource switching code and the arch generic time accessor
functions that use the clocksource infrastructure.
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/time.h')
-rw-r--r-- | include/linux/time.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/time.h b/include/linux/time.h index 88d3b81..65dd85b 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -102,6 +102,7 @@ extern int do_getitimer(int which, struct itimerval *value); extern void getnstimeofday(struct timespec *tv); extern struct timespec timespec_trunc(struct timespec t, unsigned gran); +extern int timekeeping_is_continuous(void); /** * timespec_to_ns - Convert timespec to nanoseconds @@ -144,6 +145,20 @@ extern struct timespec ns_to_timespec(const s64 nsec); */ extern struct timeval ns_to_timeval(const s64 nsec); +/** + * timespec_add_ns - Adds nanoseconds to a timespec + * @a: pointer to timespec to be incremented + * @ns: unsigned nanoseconds value to be added + */ +static inline void timespec_add_ns(struct timespec *a, u64 ns) +{ + ns += a->tv_nsec; + while(unlikely(ns >= NSEC_PER_SEC)) { + ns -= NSEC_PER_SEC; + a->tv_sec++; + } + a->tv_nsec = ns; +} #endif /* __KERNEL__ */ #define NFDBITS __NFDBITS |