A duration is represented in nanoseconds as an unsigned 64 bit integer. This has a range of up to 584 years, or 213503 days, or 5124095 hours, or 307445734 minutes, or 18446744073 seconds, or 18446744073709 milliseconds, or 18446744073709549 microseconds.
All functions converting to t raise Invalid_argument on out of bound or negative input.
of_string_exn str tries to parse str and calculate a duration. The user can specify a duration via metrics:
1ns for one nanoseconds
1us, 1μs or 1µs for one microsecond
1ms for one milliseconds
1s for one second
1m for one minute
1h for one hour
1d for one day
1y/1a for one year
The user can use multiple metrics but they can be used only once. 1d1d is invalid (you can use 2d) but 1d1y is valid and correspond to 1 year plus 1 day.
Sourceval of_string : string ->(t, [> `Msg of string ])result
of_string is of_string_exn but it returns a result instead of raising an exception.