File tree Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 11cmake_minimum_required (VERSION 3.0)
2- project (ihs_boost VERSION 1.7.0 )
2+ project (ihs_boost VERSION 1.7.1 )
33
44# options
55option (build_tests "build_tests" OFF )
Original file line number Diff line number Diff line change 11#include " accumulator.hpp"
2- #include < kipr/wombat.h>
32
43Accumulator::Accumulator (std::function<double ()> callable, int updates_per_sec)
54 : BackgroundTask(updates_per_sec), callable(callable),
Original file line number Diff line number Diff line change 1313#ifndef IHSBOOST_TIMER_HPP
1414#define IHSBOOST_TIMER_HPP
1515
16+ #include < chrono>
17+
1618/* *
1719 * @brief A class that implements a timer, useful when you want
1820 * to line-follow for a certain amount of time.
@@ -47,8 +49,8 @@ class Timer
4749 bool done () const ;
4850
4951private:
50- double _time;
51- double _start_time;
52+ int _time;
53+ std::chrono::steady_clock::time_point _start_time;
5254};
5355
5456#endif
Original file line number Diff line number Diff line change 11#include " timer.hpp"
2- #include < kipr/wombat.h>
32
4- Timer::Timer (double time) : _time(time) , _start_time(seconds ()){};
3+ Timer::Timer (double time) : _time(static_cast < int >( time * 1000000 )) , _start_time(std::chrono::steady_clock::now ()){};
54
65bool Timer::operator ()() const { return done (); }
7- bool Timer::done () const { return seconds ( ) - _start_time >= _time; }
6+ bool Timer::done () const { return std::chrono::duration_cast<std::chrono::microseconds>( std::chrono::steady_clock::now ( ) - _start_time). count () >= _time; }
You can’t perform that action at this time.
0 commit comments