Fix clock time when there's no message to get last clock value

This commit is contained in:
Richard Ramos 2018-11-08 15:17:35 -04:00
parent e67860cbca
commit 07072219f9
1 changed files with 3 additions and 3 deletions

View File

@ -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');