From f6437b60c2b2bf514a0c2e82f51fde5803b57b93 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 30 Apr 2013 09:46:33 -0700 Subject: [PATCH] Add msec/usec/nsec to tick convertors Add wrappers for the Solaris MSEC_TO_TICK, USEC_TO_TICK, and NSEC_TO_TICK conversion functions. They are mapped directly to their Linux counterparts with the exception of NSEC_TO_TICK can cannot use usecs_to_jiffies() because it is not exported by the kernel. Signed-off-by: Brian Behlendorf --- include/sys/timer.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/sys/timer.h b/include/sys/timer.h index 096eb1a4e3..13ef404524 100644 --- a/include/sys/timer.h +++ b/include/sys/timer.h @@ -37,5 +37,10 @@ #define delay(ticks) schedule_timeout((long)(ticks)) +#define SEC_TO_TICK(sec) ((sec) * HZ) +#define MSEC_TO_TICK(ms) msecs_to_jiffies(ms) +#define USEC_TO_TICK(us) usecs_to_jiffies(us) +#define NSEC_TO_TICK(ns) usecs_to_jiffies(ns / NSEC_PER_USEC) + #endif /* _SPL_TIMER_H */