From 1a036c2321e06d4c36f3e2148e67dfe6aa379296 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Mon, 11 Dec 2023 16:35:30 +0100 Subject: [PATCH] add get time ms helper --- solanaceae/message3/registry_message_model.cpp | 5 +++++ solanaceae/message3/registry_message_model.hpp | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/solanaceae/message3/registry_message_model.cpp b/solanaceae/message3/registry_message_model.cpp index 1a36c2b..b8fccf6 100644 --- a/solanaceae/message3/registry_message_model.cpp +++ b/solanaceae/message3/registry_message_model.cpp @@ -2,8 +2,13 @@ #include +#include #include +uint64_t Message::getTimeMS(void) { + return std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); +} + Message3Registry* RegistryMessageModel::get(Contact3 c) { if (_cr.valid(c) && !_cr.all_of(c)) { // TODO: loop upwards diff --git a/solanaceae/message3/registry_message_model.hpp b/solanaceae/message3/registry_message_model.hpp index 78e0f22..b0dc396 100644 --- a/solanaceae/message3/registry_message_model.hpp +++ b/solanaceae/message3/registry_message_model.hpp @@ -15,7 +15,9 @@ enum class Message3 : uint32_t {}; using Message3Registry = entt::basic_registry; using Message3Handle = entt::basic_handle; -namespace Message::Events { +namespace Message { + +namespace Events { struct MessageConstruct { const Message3Handle e; @@ -33,6 +35,11 @@ namespace Message::Events { } // Events +// get unix time in milliseconds +uint64_t getTimeMS(void); + +} // Message + enum class RegistryMessageModel_Event : uint32_t { message_construct, message_updated,