LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2] add time_now_after and other macros which compare with jiffies
@ 2008-03-07 23:35 Dave Young
  2008-03-08 16:12 ` Johannes Weiner
  0 siblings, 1 reply; 12+ messages in thread
From: Dave Young @ 2008-03-07 23:35 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

Changes from previous version:
1. Add comments
2. Change names easy to understand. For example, now time_now_after(a) means time now after a will return true.

---
Signed-off-by: Dave Young <hidave.darkstar@gmail.com>

---
include/linux/jiffies.h |   16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff -upr linux/include/linux/jiffies.h linux.new/include/linux/jiffies.h
--- linux/include/linux/jiffies.h	2008-03-07 19:56:02.000000000 +0800
+++ linux.new/include/linux/jiffies.h	2008-03-07 20:10:25.000000000 +0800
@@ -135,6 +135,22 @@ static inline u64 get_jiffies_64(void)
 #define time_before_eq64(a,b)	time_after_eq64(b,a)
 
 /*
+ * These four macros compare jiffies and 'a' for convenience.
+ */
+
+/* time_now_after(a) return true if now (jiffies) is after a */
+#define time_now_after(a) time_after(jiffies, a)
+
+/* time_now_before(a) return true if now (jiffies) is before a */
+#define time_now_before(a) time_before(jiffies, a)
+
+/* time_now_after_eq(a) return true if now (jiffies) is after or equal to a */
+#define time_now_after_eq(a) time_after_eq(jiffies, a)
+
+/* time_now_before_eq(a) return true if now (jiffies) is before or equal to a */
+#define time_now_before_eq(a) time_before_eq(jiffies, a)
+
+/*
  * Have the 32 bit jiffies value wrap 5 minutes after boot
  * so jiffies wrap bugs show up earlier.
  */

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-03-10  2:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-07 23:35 [PATCH v2] add time_now_after and other macros which compare with jiffies Dave Young
2008-03-08 16:12 ` Johannes Weiner
2008-03-09  0:54   ` Dave Young
2008-03-09  9:58     ` Alan Cox
2008-03-09 10:44       ` Dave Young
2008-03-09 11:08         ` Alan Cox
2008-03-09 19:01           ` Andrew Morton
2008-03-09 20:06             ` Alan Cox
2008-03-10  2:03             ` Dave Young
2008-03-10  2:41               ` Johannes Weiner
2008-03-09 18:36       ` Andrew Morton
2008-03-09 20:03         ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).