user1967799
user1967799

Reputation: 61

Compare jiffies with millisecond

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

Upvotes: 0

Views: 1925

Answers (1)

Anton Kovalenko
Anton Kovalenko

Reputation: 21507

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) ....

Upvotes: 1

Related Questions