From: Brian Behlendorf Date: Tue, 30 Apr 2013 16:46:33 +0000 (-0700) Subject: Add msec/usec/nsec to tick convertors X-Git-Tag: spl-0.6.2~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f6437b60c2b2bf514a0c2e82f51fde5803b57b93;p=spl 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 --- diff --git a/include/sys/timer.h b/include/sys/timer.h index 096eb1a..13ef404 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 */