From 1447169c4bcdc42011dfeada2cf0cbbc6072d009 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sun, 13 Nov 2016 10:52:15 +0200 Subject: [PATCH] kernel: Add helpers for converting durations into milliseconds These should help to make it easier to understand code passing specific durations to the kernel APIs. Change-Id: I8682fafc291e8af56fd0289d0cab8c736b88da59 Signed-off-by: Johan Hedberg --- include/kernel.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/kernel.h b/include/kernel.h index 6ed513894ce..2fdf7faf5d2 100644 --- a/include/kernel.h +++ b/include/kernel.h @@ -496,6 +496,12 @@ extern void *k_thread_custom_data_get(void); #include +/* Convenience helpers to convert durations into milliseconds */ +#define K_MSEC(ms) (ms) +#define K_SECONDS(s) K_MSEC((s) * MSEC_PER_SEC) +#define K_MINUTES(m) K_SECONDS((m) * 60) +#define K_HOURS(h) K_MINUTES((h) * 60) + /* private internal time manipulation (users should never play with ticks) */ /* added tick needed to account for tick in progress */