mirror of
				https://github.com/TomHarte/CLK.git
				synced 2025-11-04 00:16:26 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			480 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			480 B
		
	
	
	
		
			C++
		
	
	
	
	
	
//
 | 
						|
//  TimeTypes.hpp
 | 
						|
//  Clock Signal
 | 
						|
//
 | 
						|
//  Created by Thomas Harte on 21/03/2018.
 | 
						|
//  Copyright 2018 Thomas Harte. All rights reserved.
 | 
						|
//
 | 
						|
 | 
						|
#pragma once
 | 
						|
 | 
						|
#include <chrono>
 | 
						|
 | 
						|
namespace Time {
 | 
						|
 | 
						|
using Seconds = double;
 | 
						|
using Nanos = int64_t;
 | 
						|
 | 
						|
inline Nanos nanos_now() {
 | 
						|
	return std::chrono::duration_cast<std::chrono::nanoseconds>(
 | 
						|
		std::chrono::high_resolution_clock::now().time_since_epoch()
 | 
						|
	).count();
 | 
						|
}
 | 
						|
 | 
						|
inline Seconds seconds(Nanos nanos) {
 | 
						|
	return double(nanos) / 1e9;
 | 
						|
}
 | 
						|
 | 
						|
}
 |