fix rounding errors in elapsed time in logs

This commit is contained in:
Conduitry 2024-04-29 17:25:21 -04:00
parent b6c82eb4f5
commit 02ea5c7ee3

View File

@ -1,4 +1,4 @@
export const log = (...args) => {
const s = performance.now() / 1000;
console.log(`[${new Date().toISOString()}] (${Math.floor(s / 60)}m${(s % 60 + 100.05 + '').slice(1, 5)}s)`, ...args);
const s = Math.round(performance.now() / 100) / 10;
console.log(`[${new Date().toISOString()}] (${Math.floor(s / 60)}m${(s % 60).toFixed(1).padStart(4, '0')}s)`, ...args);
};