Merge branch 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / kernel / time / timekeeping_internal.h
blob9a18f121f3990b3a635c350506ada940e0c7f922
1 #ifndef _TIMEKEEPING_INTERNAL_H
2 #define _TIMEKEEPING_INTERNAL_H
3 /*
4 * timekeeping debug functions
5 */
6 #include <linux/clocksource.h>
7 #include <linux/time.h>
9 #ifdef CONFIG_DEBUG_FS
10 extern void tk_debug_account_sleep_time(struct timespec64 *t);
11 #else
12 #define tk_debug_account_sleep_time(x)
13 #endif
15 #ifdef CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE
16 static inline u64 clocksource_delta(u64 now, u64 last, u64 mask)
18 u64 ret = (now - last) & mask;
21 * Prevent time going backwards by checking the MSB of mask in
22 * the result. If set, return 0.
24 return ret & ~(mask >> 1) ? 0 : ret;
26 #else
27 static inline u64 clocksource_delta(u64 now, u64 last, u64 mask)
29 return (now - last) & mask;
31 #endif
33 extern time64_t __ktime_get_real_seconds(void);
35 #endif /* _TIMEKEEPING_INTERNAL_H */