diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-10-17 07:34:34 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-10-17 07:34:34 +0200 |
commit | 547b8f94b2f2814a6ef86e6022c6525b03fcbd2d (patch) | |
tree | 57d42415f0d0dac8f09e423eacb93cc45ccc6344 /facetracknoir | |
parent | 315d5b1e6284eade4b0df1bcabfd5430165ae764 (diff) |
don't reduce usleep at ms granularity pointlessly
Diffstat (limited to 'facetracknoir')
-rw-r--r-- | facetracknoir/tracker.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
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) |