MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / convert_time

Function convert_time

src/conversions/time.rs:70–86  ·  view source on GitHub ↗

Convert time from one unit to another # Arguments `time_value` - The time value to convert (must be non-negative) `unit_from` - The source unit (case-insensitive) `unit_to` - The target unit (case-insensitive) # Returns Returns the converted time value rounded to 3 decimal places # Errors Returns an error if: `time_value` is negative or not a valid number `unit_from` or `unit_to` is not a va

(time_value: f64, unit_from: &str, unit_to: &str)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 3

test_negative_valueFunction · 0.85
test_invalid_from_unitFunction · 0.85
test_invalid_to_unitFunction · 0.85

Calls 1

to_secondsMethod · 0.80

Tested by 3

test_negative_valueFunction · 0.68
test_invalid_from_unitFunction · 0.68
test_invalid_to_unitFunction · 0.68