From a3fccdf9df29159cac1918572cba7a7a8c3f6e8f Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Sat, 18 Jan 2025 16:12:05 -0500 Subject: [PATCH] Change number timestamp to seconds age --- src/assets/HestiaClasses.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/assets/HestiaClasses.js b/src/assets/HestiaClasses.js index 86520c3..968e29d 100644 --- a/src/assets/HestiaClasses.js +++ b/src/assets/HestiaClasses.js @@ -86,7 +86,10 @@ export class Communicator { const msgStr = message.toString(); const msgJson = JSON.parse(msgStr); console.log(`Message received on topic ${topic}: ${msgStr}`); - if (msgJson.timestamp) console.log(`Timestamp: ${msgJson.timestamp}`); + if (msgJson.timestamp) { + const age = Date.now() - msgJson.timestamp; + console.log(`Message age: ${age / 1000}s`); + } console.log(msgJson); state[msgJson.name].on = msgJson.on; if (msgJson.feedRate) state[msgJson.name].feedRate = msgJson.feedRate;