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); +