diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-11-24 16:17:12 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-11-24 16:17:12 +0100 |
commit | c0088b3d4b115d6e40c98f9a142f13f08babe7a0 (patch) | |
tree | 70c9104081316bdae77a5ccc831b839cf9f1db8e | |
parent | aa0549fd18134f5d8fc4046ab32b46352ad379a3 (diff) |
timer: split start/elapsed. convert uses
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 3 | ||||
-rw-r--r-- | opentrack/timer.hpp | 8 |
2 files changed, 4 insertions, 7 deletions
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 2fd5a514..05e7b067 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -59,7 +59,8 @@ void Tracker::run() while((commands & ABORT) == 0) { apply_inner(); - const double dt = time.start() * 1e-9; + const double dt = time.elapsed() * 1e-9; + time.start(); cv::Mat frame; const bool new_frame = camera.get_frame(dt, &frame); diff --git a/opentrack/timer.hpp b/opentrack/timer.hpp index 93c0a1f4..1b52b6c8 100644 --- a/opentrack/timer.hpp +++ b/opentrack/timer.hpp @@ -51,12 +51,8 @@ public: Timer() { start(); } - long start() { - struct timespec cur; - (void) clock_gettime(CLOCK_MONOTONIC, &cur); - long ret = conv(cur); - state = cur; - return ret; + void start() { + (void) clock_gettime(CLOCK_MONOTONIC, &state); } long elapsed() { struct timespec cur; |