2018-03-22 02:18:13 +00:00
|
|
|
//
|
|
|
|
// TimeTypes.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 21/03/2018.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2018 Thomas Harte. All rights reserved.
|
2018-03-22 02:18:13 +00:00
|
|
|
//
|
|
|
|
|
2024-01-17 04:34:46 +00:00
|
|
|
#pragma once
|
2018-03-22 02:18:13 +00:00
|
|
|
|
2020-02-10 02:44:55 +00:00
|
|
|
#include <chrono>
|
|
|
|
|
2018-03-22 02:18:13 +00:00
|
|
|
namespace Time {
|
|
|
|
|
|
|
|
typedef double Seconds;
|
2020-02-10 02:44:55 +00:00
|
|
|
typedef int64_t Nanos;
|
|
|
|
|
|
|
|
inline Nanos nanos_now() {
|
|
|
|
return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
|
|
|
|
}
|
2018-03-22 02:18:13 +00:00
|
|
|
|
2022-07-07 20:35:45 +00:00
|
|
|
inline Seconds seconds(Nanos nanos) {
|
|
|
|
return double(nanos) / 1e9;
|
|
|
|
}
|
|
|
|
|
2018-03-22 02:18:13 +00:00
|
|
|
}
|