27 lines
		
	
	
	
		
			490 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			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
 |