added interval function for current status time

This commit is contained in:
Timm 2015-03-18 12:27:33 +01:00
parent bbfd97f351
commit 700b0b327d

View File

@ -211,7 +211,12 @@ layout: default
} }
$( "#current_status_since td:last" ).html(d.toLocaleFormat(timeFormat)); $( "#current_status_since td:last" ).html(d.toLocaleFormat(timeFormat));
setInterval(function(){
currentStreak = Math.floor(Date.now() / 1000) - data.state.lastchange;
if(currentStreak >= 0)
$( "#current_status_time td:last" ).html(toHHMMSS(currentStreak) + 'h'); $( "#current_status_time td:last" ).html(toHHMMSS(currentStreak) + 'h');
}, 1000);
var doorArray = data.sensors.door_locked; var doorArray = data.sensors.door_locked;
for(i = 0; i < doorArray.length; i++) { for(i = 0; i < doorArray.length; i++) {