From 4b4c3971b81631df59facf204f2fe8a90e5f53cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Fri, 31 Mar 2017 23:48:49 -0700 Subject: [PATCH] Always use UTC for watchdog timestamps Forcing UTC will ensure that offset calculation is always correct --- assets/static/unsee.js | 2 +- assets/static/watchdog.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/static/unsee.js b/assets/static/unsee.js index e09dd3954..c2b6b2080 100644 --- a/assets/static/unsee.js +++ b/assets/static/unsee.js @@ -130,7 +130,7 @@ var Unsee = (function(params) { Colors.Update(resp['colors']); Alerts.Update(resp); updateCompleted(); - Watchdog.Pong(moment(resp['timestamp']).unix()); + Watchdog.Pong(moment(resp['timestamp']); Unsee.WaitForNextReload(); $(selectors.errors).html(''); $(selectors.errors).hide(''); diff --git a/assets/static/watchdog.js b/assets/static/watchdog.js index 4c4b85d00..e2da1af38 100644 --- a/assets/static/watchdog.js +++ b/assets/static/watchdog.js @@ -21,7 +21,7 @@ var Watchdog = (function() { // don't raise an error if autorefresh is disabled if (!Config.GetOption('autorefresh').Get()) return; - var now = moment().unix(); + var now = moment().utc().unix(); if (now - lastTs > maxLag) { Grid.Clear(); $('#errors').html(haml.compileHaml('fatal-error')({ @@ -55,7 +55,7 @@ var Watchdog = (function() { updateTs = function(ts) { - lastTs = ts; + lastTs = ts.utc().unix(); }