Skip to main content

Module time

Module time 

Source
Expand description

Duration parsing for --timeout 30s, --older-than 30d, etc.

Delegates to humantime for the wire format and converts to std::time::Duration. Keeps a single error type (InvalidArgument) so every flag that takes a duration produces the same shape on bad input.

Functions§

duration_ms
Convert a Duration to milliseconds, saturating on overflow. Used by *_ms fields in the protocol output.
parse_duration
Parse a human-readable duration (30s, 250ms, 1m, 30d) into a std::time::Duration. Empty or unparseable input returns ErrorCode::InvalidArgument.