From c5f7a7092bc9c7d7e65e960c051e79449efdc182 Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 3 Dec 2024 03:06:16 +0100 Subject: [PATCH] feat: add "h ago" marker --- web/index.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/index.html b/web/index.html index 1a9e30f..ea68fd4 100644 --- a/web/index.html +++ b/web/index.html @@ -101,6 +101,9 @@ function cell(timestamp, rtt) { function card(key, history, last_rtt) { let bar = ""; + let now = Math.floor(Date.now() / 1000); + let first = history[0][0]; + let hrs_ago = (now - first) / 3600; for (let el of history) { bar += cell(el[0], el[1]); } @@ -108,6 +111,7 @@ function card(key, history, last_rtt) {

${key} ${last_rtt ? last_rtt + 'ms' : 'DOWN'}

${bar} +

^ ~${hrs_ago.toFixed(1)}h ago

`; }