diff options
Diffstat (limited to 'facetracknoir/timer.hpp')
-rw-r--r-- | facetracknoir/timer.hpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/facetracknoir/timer.hpp b/facetracknoir/timer.hpp index 623836db..e3fa38de 100644 --- a/facetracknoir/timer.hpp +++ b/facetracknoir/timer.hpp @@ -43,22 +43,22 @@ static inline void clock_gettime(int, struct timespec* ts) class Timer { private: struct timespec state; - int conv(const struct timespec& cur) + long conv(const struct timespec& cur) { - return (cur.tv_sec - state.tv_sec) * 1000L + (cur.tv_nsec - state.tv_nsec) / 1000000L; + return (cur.tv_sec - state.tv_sec) * 1000000000L + (cur.tv_nsec - state.tv_nsec); } public: Timer() { start(); } - int start() { + long start() { struct timespec cur; (void) clock_gettime(CLOCK_MONOTONIC, &cur); int ret = conv(cur); state = cur; return ret; } - int elapsed() { + long elapsed() { struct timespec cur; (void) clock_gettime(CLOCK_MONOTONIC, &cur); return conv(cur); |