From 6cbcc9463ce3c4344e06d74d7df67175ada83b5f Mon Sep 17 00:00:00 2001 From: Green Sky Date: Tue, 7 Jan 2025 15:51:20 +0100 Subject: [PATCH] move in time from messages --- CMakeLists.txt | 3 +++ solanaceae/util/time.cpp | 12 ++++++++++++ solanaceae/util/time.hpp | 7 +++++++ 3 files changed, 22 insertions(+) create mode 100644 solanaceae/util/time.cpp create mode 100644 solanaceae/util/time.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9846591..a70b651 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,9 @@ add_library(solanaceae_util ./solanaceae/util/utils.hpp ./solanaceae/util/utils.cpp + ./solanaceae/util/time.hpp + ./solanaceae/util/time.cpp + ./solanaceae/util/uuid_generator.hpp ./solanaceae/util/uuid_generator.cpp diff --git a/solanaceae/util/time.cpp b/solanaceae/util/time.cpp new file mode 100644 index 0000000..6b44e99 --- /dev/null +++ b/solanaceae/util/time.cpp @@ -0,0 +1,12 @@ +#include "./time.hpp" + +#include + +uint64_t getTimeMS(void) { + return + std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch() + ).count() + ; +} + diff --git a/solanaceae/util/time.hpp b/solanaceae/util/time.hpp new file mode 100644 index 0000000..1c83ffc --- /dev/null +++ b/solanaceae/util/time.hpp @@ -0,0 +1,7 @@ +#pragma once + +#include + +// get unix time in milliseconds +uint64_t getTimeMS(void); +