/** * Formatting utility functions for display values. */ // Re-export token formatting from shared moduleexport { formatTokensCompact } from '@shared/utils/tokenFormatting'; /** * Formats duration in milliseconds to a human-readable string. */export function formatDuration(ms: number): string { if (ms < 1000) { return `${Math.round(ms)}ms`; } const seconds = ms / 1000; if (seconds < 60) { return `${seconds.toFixed(1)}s`; } const minutes = Math.floor(seconds / 60); const remainingSeconds = Math.round(seconds % 60); return `${minutes}m ${remainingSeconds}s`;}
/**
* Formatting utility functions for display values.
*/
// Re-export token formatting from shared module
export { formatTokensCompact } from '@shared/utils/tokenFormatting';
/**
* Formats duration in milliseconds to a human-readable string.
*/
export function formatDuration(ms: number): string {
if (ms < 1000) {
return `${Math.round(ms)}ms`;
}
const seconds = ms / 1000;
if (seconds < 60) {
return `${seconds.toFixed(1)}s`;
}
const minutes = Math.floor(seconds / 60);
const remainingSeconds = Math.round(seconds % 60);
return `${minutes}m ${remainingSeconds}s`;
}