From 547b8f94b2f2814a6ef86e6022c6525b03fcbd2d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 17 Oct 2014 07:34:34 +0200 Subject: don't reduce usleep at ms granularity pointlessly --- facetracknoir/tracker.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'facetracknoir') diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 4a80c722..09edd45b 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -141,8 +141,10 @@ void Tracker::run() { raw_6dof = final_raw; } - const long q = 1000L * std::max(0L, sleep_ms - t.elapsed_ms()); - usleep(q); + double q = sleep_ms * 1000L; + q -= t.elapsed(); + q = std::max(0., q); + usleep((long)q); } #if defined(_WIN32) -- cgit v1.2.3