diff --git a/dsp_lib.hpp b/dsp_lib.hpp index 85d0550..4aab1f7 100644 --- a/dsp_lib.hpp +++ b/dsp_lib.hpp @@ -82,14 +82,14 @@ class Clocker { Clocker(std::chrono::milliseconds period): period(period) {}; void tick() { if(next_tick == std::chrono::time_point::min()) { - next_tick = std::chrono::steady_clock::now() + period; + next_tick = std::chrono::steady_clock::now(); } else { + next_tick += period; auto duration = next_tick - std::chrono::steady_clock::now(); if(duration >= duration.zero()) std::this_thread::sleep_for(duration); else std::cerr << "missed tick" << std::endl; - next_tick += period; } } };