eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 443 B
JavaScript
const SECOND_MS=1e3;function formatElapsed(e){if(!Number.isFinite(e)||e<0)throw RangeError(`Elapsed time must be a finite, non-negative number.`);let t=Math.round(e);if(t<SECOND_MS)return`${t}ms`;if(t<6e4)return`${Math.round(t/100)/10}s`;let n=Math.floor(t/SECOND_MS),r=n%60,i=Math.floor(n/60),a=i%60,o=Math.floor(i/60),s=o%24,c=Math.floor(o/24);return c>0?`${c}d ${s}h ${a}m ${r}s`:o>0?`${o}h ${a}m ${r}s`:`${i}m ${r}s`}export{formatElapsed};