timestamps as SecondsSinceEpoc

This commit is contained in:
Justin Hammond 2019-11-07 11:00:29 +08:00
parent fa938304ca
commit 9746a8f600
3 changed files with 7 additions and 6 deletions

View file

@ -52,8 +52,8 @@ struct NodeStatistics {
quint32 receivedPackets; /**< Number of received Packets from the Node */
quint32 receivedDupPackets; /**< Number of Duplicate Packets received from the Node */
quint32 receivedUnsolicited; /**< Number of Unsolicited Packets received from the Node */
QString lastSentTimeStamp; /**< TimeStamp of the Last time we sent a packet to the Node */
QString lastReceivedTimeStamp; /**< Timestamp of the last time we received a packet from the Node */
QDateTime lastSentTimeStamp; /**< TimeStamp of the Last time we sent a packet to the Node */
QDateTime lastReceivedTimeStamp; /**< Timestamp of the last time we received a packet from the Node */
quint32 lastRequestRTT; /**< Last Round-Trip Time when we made a request to the Node */
quint32 averageRequestRTT; /**< Average Round-Trip Time when we make requests to a Node */
quint32 lastResponseRTT; /**< Last Round-Trip Time when we got a Response from a Node */

View file

@ -494,13 +494,14 @@ NodeStatistics QTOZWManager_Internal::GetNodeStatistics(quint8 const _node) {
ns.receivedPackets = nd.m_receivedCnt;
ns.lastFailedLinkTo = nd.m_lastFailedLinkTo;
ns.averageRequestRTT = nd.m_averageRequestRTT;
ns.lastSentTimeStamp = nd.m_sentTS.c_str();
/* 2019-11-06 21:11:02:549 */
ns.lastSentTimeStamp = QDateTime::fromString(nd.m_sentTS.c_str(), "YYYY-MM-DD HH:mm:ss:zzz");
ns.lastReceivedTimeStamp = QDateTime::fromString(nd.m_receivedTS.c_str(), "YYYY-MM-DD HH:mm:ss:zzz");
ns.averageResponseRTT = nd.m_averageResponseRTT;
ns.lastFailedLinkFrom = nd.m_lastFailedLinkFrom;
ns.receivedDupPackets = nd.m_receivedDups;
ns.extendedTXSupported = nd.m_txStatusReportSupported;
ns.receivedUnsolicited = nd.m_receivedUnsolicited;
ns.lastReceivedTimeStamp = nd.m_receivedTS.c_str();
return ns;
} catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWManagerErrorCodes::OZWException);

View file

@ -315,8 +315,8 @@ void mqttpublisher::doStats() {
nsjson["receivedPackets"] = static_cast<qint64>(ns.receivedPackets); /**< Number of received Packets from the Node */
nsjson["receivedDupPackets"] = static_cast<qint64>(ns.receivedDupPackets); /**< Number of Duplicate Packets received from the Node */
nsjson["receivedUnsolicited"] = static_cast<qint64>(ns.receivedUnsolicited); /**< Number of Unsolicited Packets received from the Node */
nsjson["lastSentTimeStamp"] = ns.lastSentTimeStamp; /**< TimeStamp of the Last time we sent a packet to the Node */
nsjson["lastRecievedTimeStamp"] = ns.lastReceivedTimeStamp; /**< Timestamp of the last time we received a packet from the Node */
nsjson["lastSentTimeStamp"] = ns.lastSentTimeStamp.toSecsSinceEpoch(); /**< TimeStamp of the Last time we sent a packet to the Node */
nsjson["lastRecievedTimeStamp"] = ns.lastReceivedTimeStamp.toSecsSinceEpoch(); /**< Timestamp of the last time we received a packet from the Node */
nsjson["lastRequestRTT"] = static_cast<qint64>(ns.lastRequestRTT); /**< Last Round-Trip Time when we made a request to the Node */
nsjson["averageRequestRTT"] = static_cast<qint64>(ns.averageRequestRTT); /**< Average Round-Trip Time when we make requests to a Node */
nsjson["lastResponseRTT"] = static_cast<qint64>(ns.lastResponseRTT); /**< Last Round-Trip Time when we got a Response from a Node */