aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/time.h
diff options
context:
space:
mode:
authorjohn stultz <johnstul@us.ibm.com>2006-06-26 03:25:08 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-26 12:58:20 -0400
commitcf3c769b4b0dd1146da84d5cf045dcfe53bd0f13 (patch)
treecaeb91eff6538ed5910e673a40a9f2bd9a022afa /include/linux/time.h
parent5eb6d20533d14a432df714520939a6181e28f099 (diff)
[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.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/time.h b/include/linux/time.h
index 88d3b812841e..65dd85b2105e 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -102,6 +102,7 @@ extern int do_getitimer(int which, struct itimerval *value);
102extern void getnstimeofday(struct timespec *tv); 102extern void getnstimeofday(struct timespec *tv);
103 103
104extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 104extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
105extern int timekeeping_is_continuous(void);
105 106
106/** 107/**
107 * timespec_to_ns - Convert timespec to nanoseconds 108 * timespec_to_ns - Convert timespec to nanoseconds
@@ -144,6 +145,20 @@ extern struct timespec ns_to_timespec(const s64 nsec);
144 */ 145 */
145extern struct timeval ns_to_timeval(const s64 nsec); 146extern struct timeval ns_to_timeval(const s64 nsec);
146 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 */
153static 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}
147#endif /* __KERNEL__ */ 162#endif /* __KERNEL__ */
148 163
149#define NFDBITS __NFDBITS 164#define NFDBITS __NFDBITS