0

In kernel i want compare jiffies with millisecond. Can we do like this with 5 ms in if statement? Can you help me?

jiffies>5

user1967799
  • 61
  • 1
  • 3
  • Jiffies, as you probably know, are a measurement of time. Jiffies are usually about 4ms if you are using the UNIX timer that I usually user (forget its name, it's been awhile). So your comparison (if I'm reading your question right...) would be if (jiffies > 1), really. – PinkElephantsOnParade Jan 10 '13 at 19:02
  • i want compare exact time. – user1967799 Jan 10 '13 at 19:32

1 Answers1

1

From include/linux/jiffies.h:

extern unsigned int jiffies_to_msecs(const unsigned long j);

If it's there for your kernel, convert jiffies to milliseconds and compare as you want:

#include <linux/jiffies.h>
...
... if (jiffies_to_msecs(jiffies)>5u) ....
Anton Kovalenko
  • 20,999
  • 2
  • 37
  • 69