1 #ifndef _LINUX_JIFFIES_H
2 #define _LINUX_JIFFIES_H
4 #include <linux/kernel.h>
5 #include <linux/types.h>
6 #include <linux/spinlock.h>
7 #include <linux/seqlock.h>
8 #include <asm/system.h>
9 #include <asm/param.h> /* for HZ */
12 * The 64-bit value is not volatile - you MUST NOT read it
13 * without sampling the sequence number in xtime_lock.
14 * get_jiffies_64() will do this for you as appropriate.
16 extern u64 jiffies_64
;
17 extern unsigned long volatile jiffies
;
19 #if (BITS_PER_LONG < 64)
20 u64
get_jiffies_64(void);
22 static inline u64
get_jiffies_64(void)
29 * These inlines deal with timer wrapping correctly. You are
30 * strongly encouraged to use them
31 * 1. Because people otherwise forget
32 * 2. Because if the timer wrap changes in future you won't have to
33 * alter your driver code.
35 * time_after(a,b) returns true if the time a is after time b.
37 * Do this with "<0" and ">=0" to only test the sign of the result. A
38 * good compiler would generate better code (and a really good compiler
39 * wouldn't care). Gcc is currently neither.
41 #define time_after(a,b) \
42 (typecheck(unsigned long, a) && \
43 typecheck(unsigned long, b) && \
44 ((long)(b) - (long)(a) < 0))
45 #define time_before(a,b) time_after(b,a)
47 #define time_after_eq(a,b) \
48 (typecheck(unsigned long, a) && \
49 typecheck(unsigned long, b) && \
50 ((long)(a) - (long)(b) >= 0))
51 #define time_before_eq(a,b) time_after_eq(b,a)