light/modules/time/include/time/timer.hpp
light7734 940d1aff9f
Some checks failed
continuous-integration/drone/push Build is failing
tests: refactor time module tests
2025-07-15 15:53:30 +03:30

27 lines
490 B
C++

#pragma once
#include <chrono>
namespace lt {
/** Simple timer class to keep track of the elapsed time. */
class Timer
{
public:
using Clock = std::chrono::steady_clock;
using Duration = std::chrono::duration<double>;
using Timepoint = std::chrono::time_point<std::chrono::steady_clock>;
Timer(Timepoint start = Clock::now());
void reset(Timepoint start = Clock::now());
[[nodiscard]] auto elapsed_time() const -> Duration;
private:
Timepoint m_start;
};
} // namespace lt