From 2736e37e4a8efdb850c839860dce24b1ae530c48 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 19 Jul 2021 10:58:10 +1000 Subject: [PATCH] [common] timer: fix timespec parameters when interval >= 1000 --- common/src/platform/linux/time.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/platform/linux/time.c b/common/src/platform/linux/time.c index 8f8cd17d..98ba3ac2 100644 --- a/common/src/platform/linux/time.c +++ b/common/src/platform/linux/time.c @@ -77,8 +77,8 @@ bool lgCreateTimer(const unsigned int intervalMS, LGTimerFn fn, struct timespec interval = { - .tv_sec = 0, - .tv_nsec = intervalMS * 1000 * 1000, + .tv_sec = intervalMS / 1000, + .tv_nsec = (intervalMS % 1000) * 1000000, }; struct itimerspec spec = {