feat: show also precise last sample time

This commit is contained in:
əlemi 2024-12-10 19:04:20 +01:00
parent 7f4b89f192
commit 7dff1a9f78
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -146,6 +146,8 @@ function card(key, history, last_rtt) {
let bar = ""; let bar = "";
let now = Math.floor(Date.now() / 1000); let now = Math.floor(Date.now() / 1000);
let first = history[history.length - 1][0]; let first = history[history.length - 1][0];
let last = history[0][0];
let min_ago = (now - last) / 60;
let hrs_ago = (now - first) / 3600; let hrs_ago = (now - first) / 3600;
for (let el of history) { for (let el of history) {
bar += cell(el[0], el[1]); bar += cell(el[0], el[1]);
@ -157,7 +159,7 @@ function card(key, history, last_rtt) {
<td colspan="2">${bar}</td> <td colspan="2">${bar}</td>
</tr> </tr>
<tr> <tr>
<td><small>^ now</small></td> <td><small>^ ~${min_ago.toFixed(0)}min ago</small></td>
<td class="rev"><small>~${hrs_ago.toFixed(1)}h ago ^</small></td> <td class="rev"><small>~${hrs_ago.toFixed(1)}h ago ^</small></td>
</tr> </tr>
</table> </table>