From 7075fe2c54c6cd988c512bbb4658b398b1abe9ca Mon Sep 17 00:00:00 2001 From: vmfortress Date: Sat, 30 Oct 2021 22:59:14 -0400 Subject: [PATCH] [common] time: fixed time values in nsleep Time values of scientific notation replaced with expanded values and `tv_nsec` simplified with modulo --- common/include/common/time.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/include/common/time.h b/common/include/common/time.h index 6c1059ff..dd241839 100644 --- a/common/include/common/time.h +++ b/common/include/common/time.h @@ -61,8 +61,8 @@ static inline void nsleep(uint64_t ns) #else const struct timespec ts = { - .tv_sec = ns / 1e9, - .tv_nsec = ns - ((ns / 1e9) * 1e9) + .tv_sec = ns / 1000000000, + .tv_nsec = ns % 1000000000, }; nanosleep(&ts, NULL); #endif