Results for “duration”
Small, practical examples. Search by task or narrow things down below.
Convert a duration to another unit explicitly
C++: duration_cast converts units and truncates fractional integer units.
C++✓ Tested
Convert a duration to hours and minutes
Python: Use divmod to split nonnegative whole seconds into display components.
Python✓ Tested
Express a duration in milliseconds
Express a duration in milliseconds in a complete Rust program using the standard library.
Rust✓ Tested
Format a bounded duration as hours minutes and seconds
PowerShell: TimeSpan can format duration components with escaped separators.
PowerShell✓ Tested
Measure a duration between instants
Java: Use Duration for elapsed timeline time and retrieve total seconds.
Java✓ Tested
Measure a duration between instants
Measure a duration between instants using a complete Go program with explicit sample inputs.
Go✓ Tested
Parse a duration string
Parse a duration string using a complete Go program with explicit sample inputs.
Go✓ Tested
Subtract durations without underflow
Subtract durations without underflow in a complete Rust program using the standard library.
Rust✓ Tested
Check whether a floating-point value is finite
Check whether a floating-point value is finite in a complete Rust program using the standard library.
Rust✓ Tested
Clamp a number to a valid interval
Clamp a number to a valid interval in a complete Rust program using the standard library.
Rust✓ Tested
Construct an instant relative to the Unix epoch
Construct an instant relative to the Unix epoch in a complete Rust program using the standard library.
Rust✓ Tested
Format whole seconds as hours minutes and seconds
JavaScript: Use integer divisions and remainders for a nonnegative duration.
JavaScript✓ Tested