[common] timer: fix timespec parameters when interval >= 1000

This commit is contained in:
Geoffrey McRae 2021-07-19 10:58:10 +10:00
parent e4e1451eaa
commit 2736e37e4a

View File

@ -77,8 +77,8 @@ bool lgCreateTimer(const unsigned int intervalMS, LGTimerFn fn,
struct timespec interval = struct timespec interval =
{ {
.tv_sec = 0, .tv_sec = intervalMS / 1000,
.tv_nsec = intervalMS * 1000 * 1000, .tv_nsec = (intervalMS % 1000) * 1000000,
}; };
struct itimerspec spec = struct itimerspec spec =
{ {