Detect and correct for client side clock skew

This commit is contained in:
Zaid Abdulla committed 2021-07-25 12:48:42 -07:00
1 parent cfe279b511
commit 1a53a320da
2 files changed
+37 -8

No files matched your search

+2 -2
View File
@@ -78,7 +78,7 @@ const component: ClosureComponent = (): Component => {
const { value, timestamp, parameter } = evaluateParam(
vnode.attrs["parameter"],
vnode.attrs["device"],
store.getTimestamp()
store.getTimestamp() + store.getClockSkew()
);
if (value == null) return null;
@@ -117,7 +117,7 @@ const component: ClosureComponent = (): Component => {
e.redraw = false;
// Don't update any child element
if (e.target === (el as VnodeDOM).dom) {
const now = Date.now();
const now = Date.now() + store.getClockSkew();
const localeString = new Date(timestamp).toLocaleString();
e.target.title = `${localeString} (${timeAgo(now - timestamp)})`;
}