Format settings latency readouts (#1170)
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
export function formatLatency(latencyMs: number): string {
|
||||
if (latencyMs < 1) {
|
||||
return `${Math.round(latencyMs * 1000)}\u00b5s`;
|
||||
}
|
||||
|
||||
if (latencyMs < 1000) {
|
||||
return `${Math.round(latencyMs)}ms`;
|
||||
}
|
||||
|
||||
const seconds = latencyMs / 1000;
|
||||
const roundedSeconds = Math.round(seconds * 10) / 10;
|
||||
return Number.isInteger(roundedSeconds) ? `${roundedSeconds}s` : `${roundedSeconds.toFixed(1)}s`;
|
||||
}
|
||||
Reference in New Issue
Block a user