From 07072219f99cecbeb622f12fa4cbdc6a7afddc05 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Thu, 8 Nov 2018 15:17:35 -0400 Subject: [PATCH] Fix clock time when there's no message to get last clock value --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 3d97b19..c3c1409 100644 --- a/src/index.js +++ b/src/index.js @@ -14,10 +14,10 @@ const CONTACT_DISCOVERY_TOPIC = '0xf8946aac'; const CONTACT_CODE_REGEXP = /^(0x)?[0-9a-f]{130}$/i; function createStatusPayload(content, messageType, clockValue, isJson) { - const tag = '~#c4'; - if(!clockValue){ - clockValue = (new Date().getTime()) * 100; + const oneMonthInMs = 60 * 60 * 24 * 31 * 1000; + if(clockValue < (new Date().getTime())){ + clockValue = (new Date().getTime() + oneMonthInMs) * 100; } const contentType = (isJson ? 'content/json' : 'text/plain');