diff --git a/src/utility/linux_kernel/time_keeping.cpp b/src/utility/linux_kernel/time_keeping.cpp index 8c99dc3..4a03aac 100644 --- a/src/utility/linux_kernel/time_keeping.cpp +++ b/src/utility/linux_kernel/time_keeping.cpp @@ -19,7 +19,6 @@ #ifndef ARDUINO #include #include - #include #include "time_keeping.h" #ifdef __cplusplus @@ -41,7 +40,7 @@ namespace cirque_pinnacle_arduino_wrappers { { struct timespec req; req.tv_sec = (time_t)microseconds / 1000000; - req.tv_nsec = (microseconds / 1000000) * 1000; + req.tv_nsec = (microseconds % 1000000) * 1000; //nanosleep(&req, (struct timespec *)NULL); clock_nanosleep(CLOCK_REALTIME, 0, &req, NULL); } diff --git a/src/utility/mraa/time_keeping.cpp b/src/utility/mraa/time_keeping.cpp index 8c99dc3..4a03aac 100644 --- a/src/utility/mraa/time_keeping.cpp +++ b/src/utility/mraa/time_keeping.cpp @@ -19,7 +19,6 @@ #ifndef ARDUINO #include #include - #include #include "time_keeping.h" #ifdef __cplusplus @@ -41,7 +40,7 @@ namespace cirque_pinnacle_arduino_wrappers { { struct timespec req; req.tv_sec = (time_t)microseconds / 1000000; - req.tv_nsec = (microseconds / 1000000) * 1000; + req.tv_nsec = (microseconds % 1000000) * 1000; //nanosleep(&req, (struct timespec *)NULL); clock_nanosleep(CLOCK_REALTIME, 0, &req, NULL); } diff --git a/src/utility/pigpio/time_keeping.cpp b/src/utility/pigpio/time_keeping.cpp index d94b2bb..4a03aac 100644 --- a/src/utility/pigpio/time_keeping.cpp +++ b/src/utility/pigpio/time_keeping.cpp @@ -40,7 +40,7 @@ namespace cirque_pinnacle_arduino_wrappers { { struct timespec req; req.tv_sec = (time_t)microseconds / 1000000; - req.tv_nsec = (microseconds / 1000000) * 1000; + req.tv_nsec = (microseconds % 1000000) * 1000; //nanosleep(&req, (struct timespec *)NULL); clock_nanosleep(CLOCK_REALTIME, 0, &req, NULL); }