reth_cli_util::parsers

Function parse_duration_from_secs_or_ms

Source
pub fn parse_duration_from_secs_or_ms(
    arg: &str,
) -> Result<Duration, ParseIntError>
Expand description

Helper to parse a Duration from seconds if it’s a number or milliseconds if the input contains a ms suffix:

  • 5ms -> 5 milliseconds
  • 5 -> 5 seconds
  • 5s -> 5 seconds