diff --git a/CMakeLists.txt b/CMakeLists.txt index 64101522..37486a2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.0) -project(ihs_boost VERSION 1.7.0) +project(ihs_boost VERSION 1.7.1) # options option(build_tests "build_tests" OFF) diff --git a/modules/threading/src/accumulator.cpp b/modules/threading/src/accumulator.cpp index 2146bd56..542bda17 100644 --- a/modules/threading/src/accumulator.cpp +++ b/modules/threading/src/accumulator.cpp @@ -1,5 +1,4 @@ #include "accumulator.hpp" -#include Accumulator::Accumulator(std::function callable, int updates_per_sec) : BackgroundTask(updates_per_sec), callable(callable), diff --git a/modules/util/include/timer.hpp b/modules/util/include/timer.hpp index bdd7808d..c9940c1e 100644 --- a/modules/util/include/timer.hpp +++ b/modules/util/include/timer.hpp @@ -13,6 +13,8 @@ #ifndef IHSBOOST_TIMER_HPP #define IHSBOOST_TIMER_HPP +#include + /** * @brief A class that implements a timer, useful when you want * to line-follow for a certain amount of time. @@ -47,8 +49,8 @@ class Timer bool done() const; private: - double _time; - double _start_time; + int _time; + std::chrono::steady_clock::time_point _start_time; }; #endif diff --git a/modules/util/src/timer.cpp b/modules/util/src/timer.cpp index 2e5e9a80..a48f4656 100644 --- a/modules/util/src/timer.cpp +++ b/modules/util/src/timer.cpp @@ -1,7 +1,6 @@ #include "timer.hpp" -#include -Timer::Timer(double time) : _time(time), _start_time(seconds()){}; +Timer::Timer(double time) : _time(static_cast(time * 1000000)), _start_time(std::chrono::steady_clock::now()){}; bool Timer::operator()() const { return done(); } -bool Timer::done() const { return seconds() - _start_time >= _time; } \ No newline at end of file +bool Timer::done() const { return std::chrono::duration_cast(std::chrono::steady_clock::now() - _start_time).count() >= _time; } \ No newline at end of file