From a884e24b9a37e6ebf67a0e7d55d7dcafecb86ca2 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Mon, 7 Sep 2020 15:25:00 +0200 Subject: [PATCH] aux: Support waiting more than 0.999... seconds in os_nanosleep --- src/xrt/auxiliary/os/os_time.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/xrt/auxiliary/os/os_time.h b/src/xrt/auxiliary/os/os_time.h index d1844ffdd..ac63e0520 100644 --- a/src/xrt/auxiliary/os/os_time.h +++ b/src/xrt/auxiliary/os/os_time.h @@ -64,8 +64,9 @@ os_nanosleep(long nsec) { #ifdef XRT_OS_LINUX struct timespec spec; - spec.tv_sec = 0; - spec.tv_nsec = nsec, nanosleep(&spec, NULL); + spec.tv_sec = (nsec / (1000 * 1000 * 1000)); + spec.tv_nsec = (nsec % (1000 * 1000 * 1000)); + nanosleep(&spec, NULL); #endif }