summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2013-04-30 09:46:33 -0700
committerBrian Behlendorf <[email protected]>2013-05-01 12:07:56 -0700
commitf6437b60c2b2bf514a0c2e82f51fde5803b57b93 (patch)
tree8f843dfc39a5dea2192422637088dd08f2612b1c /include
parent8bbda8df3ea618cd994d477d6d5c0e0acec80089 (diff)
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 <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/sys/timer.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/sys/timer.h b/include/sys/timer.h
index 096eb1a4e..13ef40452 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 */