summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir/tracker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'facetracknoir/tracker.cpp')
-rw-r--r--facetracknoir/tracker.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp
index f17b257f..0f299153 100644
--- a/facetracknoir/tracker.cpp
+++ b/facetracknoir/tracker.cpp
@@ -150,8 +150,10 @@ void Tracker::run() {
logic();
- 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)