add get time ms helper

This commit is contained in:
Green Sky 2023-12-11 16:35:30 +01:00
parent 48fb5f0889
commit 1a036c2321
No known key found for this signature in database
2 changed files with 13 additions and 1 deletions

View File

@ -2,8 +2,13 @@
#include <solanaceae/contact/components.hpp> #include <solanaceae/contact/components.hpp>
#include <chrono>
#include <iostream> #include <iostream>
uint64_t Message::getTimeMS(void) {
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
}
Message3Registry* RegistryMessageModel::get(Contact3 c) { Message3Registry* RegistryMessageModel::get(Contact3 c) {
if (_cr.valid(c) && !_cr.all_of<Contact::Components::TagBig>(c)) { if (_cr.valid(c) && !_cr.all_of<Contact::Components::TagBig>(c)) {
// TODO: loop upwards // TODO: loop upwards

View File

@ -15,7 +15,9 @@ enum class Message3 : uint32_t {};
using Message3Registry = entt::basic_registry<Message3>; using Message3Registry = entt::basic_registry<Message3>;
using Message3Handle = entt::basic_handle<Message3Registry>; using Message3Handle = entt::basic_handle<Message3Registry>;
namespace Message::Events { namespace Message {
namespace Events {
struct MessageConstruct { struct MessageConstruct {
const Message3Handle e; const Message3Handle e;
@ -33,6 +35,11 @@ namespace Message::Events {
} // Events } // Events
// get unix time in milliseconds
uint64_t getTimeMS(void);
} // Message
enum class RegistryMessageModel_Event : uint32_t { enum class RegistryMessageModel_Event : uint32_t {
message_construct, message_construct,
message_updated, message_updated,