diff --git a/assets/index.js b/assets/index.js index 798181e..4643474 100644 --- a/assets/index.js +++ b/assets/index.js @@ -77,24 +77,31 @@ function updateClientInfo() { return; } - // say we're loading locationElement.classList.add("loading"); fetch(window.location.href) .then((response) => { const clientInfo = response.headers.get("X-Client-Info"); - if (!clientInfo) { throw new Error("X-Client-Info header not present"); } + // Clean up the time value and convert units const cleanClientInfo = clientInfo + // Replace UTF-8 encoded microsecond symbols .replace(/\u00C2\u00B5s/g, "µs") .replace(/µs/g, "µs") + // Convert microseconds to picoseconds for display + .replace(/(\d+\.?\d*)\s*µs/g, (match, number) => { + const picoseconds = parseFloat(number) * 1000000; + return `${picoseconds.toLocaleString(undefined, { + maximumFractionDigits: 2, + })} ps`; + }) + // Remove any other non-ASCII characters .replace(/[\u0080-\u00FF]/g, "") .trim(); - // dumb smooth transition lmao requestAnimationFrame(() => { locationElement.textContent = cleanClientInfo; locationElement.classList.remove("loading");