Utility functions for common operations.
Formats a duration in milliseconds to a human-readable string.