26 lines
529 B
C++
26 lines
529 B
C++
// -*- mode: c++ -*-
|
|
|
|
#pragma once
|
|
|
|
#include "../time.h"
|
|
|
|
#include <chrono>
|
|
|
|
namespace atlas::time {
|
|
class HighResolutionTimer : public Timer<std::chrono::milliseconds> {
|
|
public:
|
|
void start() override
|
|
{
|
|
m_start = std::chrono::high_resolution_clock::now();
|
|
}
|
|
|
|
auto elapsed() const -> duration_type override
|
|
{
|
|
return std::chrono::duration_cast<duration_type>(std::chrono::high_resolution_clock::now() - m_start);
|
|
}
|
|
|
|
private:
|
|
std::chrono::high_resolution_clock::time_point m_start;
|
|
};
|
|
|
|
}
|