light/modules/time/public/timer.hpp
light7734 cd886aa8c9
Some checks reported errors
continuous-integration/drone/push Build was killed
refactor: flatten directory structure
2025-07-20 04:46:15 +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