From 877fb5b93ada9b25b4d2f5ca5f69370fa345f1ac Mon Sep 17 00:00:00 2001 From: Vaxry Date: Wed, 16 Apr 2025 01:37:48 +0100 Subject: time: move to stl's clocks and move timer --- src/helpers/time/Time.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/helpers/time/Time.hpp (limited to 'src/helpers/time/Time.hpp') diff --git a/src/helpers/time/Time.hpp b/src/helpers/time/Time.hpp new file mode 100644 index 00000000..eb3b5771 --- /dev/null +++ b/src/helpers/time/Time.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include +#include +#include +#include + +//NOLINTNEXTLINE +namespace Time { + using steady_tp = std::chrono::steady_clock::time_point; + using system_tp = std::chrono::system_clock::time_point; + using steady_dur = std::chrono::steady_clock::duration; + using system_dur = std::chrono::system_clock::duration; + + steady_tp steadyNow(); + system_tp systemNow(); + + steady_tp fromTimespec(const timespec*); + struct timespec toTimespec(const steady_tp& tp); + + uint64_t millis(const steady_tp& tp); + uint64_t millis(const system_tp& tp); + std::pair secNsec(const steady_tp& tp); + std::pair secNsec(const system_tp& tp); +}; \ No newline at end of file -- cgit v1.2.3