Fix util::timer: add timer duration to tracked time point instead of replacing it with now()

This commit is contained in:
Nikita Lisitsa 2022-02-02 18:14:26 +03:00
parent d369abc61b
commit 460632a118
2 changed files with 2 additions and 2 deletions

View file

@ -42,7 +42,7 @@ namespace psemek::util
return duration().count(); return duration().count();
} }
private: protected:
time_point_type start_; time_point_type start_;
}; };

View file

@ -17,7 +17,7 @@ namespace psemek::util
{ {
if (this->duration() >= duration_) if (this->duration() >= duration_)
{ {
this->restart(); this->start_ += std::chrono::duration_cast<typename Clock::duration>(duration_);
return true; return true;
} }