diff options
| author | Vaxry <vaxry@vaxry.net> | 2025-04-16 01:37:48 +0100 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2025-04-16 01:37:48 +0100 |
| commit | 877fb5b93ada9b25b4d2f5ca5f69370fa345f1ac (patch) | |
| tree | 5b52ad19c695590ae50c7adae06b8e3aeccf34c1 /src/helpers/time/Time.hpp | |
| parent | 0e521788bcc414c9cf81648d3167757d83deb60f (diff) | |
time: move to stl's clocks and move timer
Diffstat (limited to 'src/helpers/time/Time.hpp')
| -rw-r--r-- | src/helpers/time/Time.hpp | 25 |
1 files changed, 25 insertions, 0 deletions
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 <chrono> +#include <cstdint> +#include <utility> +#include <ctime> + +//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<uint64_t, uint64_t> secNsec(const steady_tp& tp); + std::pair<uint64_t, uint64_t> secNsec(const system_tp& tp); +};
\ No newline at end of file |
