diff --git a/src/lib/ebus/message.cpp b/src/lib/ebus/message.cpp index 40d6a907..4be00434 100644 --- a/src/lib/ebus/message.cpp +++ b/src/lib/ebus/message.cpp @@ -119,6 +119,7 @@ Message::Message(const string& circuit, const string& level, const string& name, setScanMessage(); m_pollPriority = 0; } + time(&m_createTime); } Message::Message(const string& circuit, const string& level, const string& name, @@ -132,6 +133,7 @@ Message::Message(const string& circuit, const string& level, const string& name, m_pollPriority(0), m_usedByCondition(false), m_isScanMessage(true), m_condition(nullptr), m_lastUpdateTime(0), m_lastChangeTime(0), m_pollOrder(0), m_lastPollTime(0) { + time(&m_createTime); } diff --git a/src/lib/ebus/message.h b/src/lib/ebus/message.h index 16d34c30..353267fc 100644 --- a/src/lib/ebus/message.h +++ b/src/lib/ebus/message.h @@ -511,6 +511,12 @@ class Message : public AttributedItem { */ const SlaveSymbolString& getLastSlaveData() const { return m_lastSlaveData; } + /** + * Get the time when this message was created. + * @return the time when this message was created. + */ + time_t getCreateTime() const { return m_createTime; } + /** * Get the time when this message was last seen with reasonable data. * @return the time when this message was last seen, or 0. @@ -643,6 +649,9 @@ class Message : public AttributedItem { /** the last seen @a SlaveSymbolString. */ SlaveSymbolString m_lastSlaveData; + /** the system time when the message was created. */ + time_t m_createTime; + /** the system time when the message was last updated, 0 for never. */ time_t m_lastUpdateTime;