Skip to main content

Module timeval

Module timeval 

Source
Expand description

Shared parser for user-facing time-valued settings.

The convention for time-based settings a user sets (e.g. the CQL timeout op field): a value is EITHER

  • a duration spec-string with a unit suffix — 60s, 500ms, 1h30m, 2.5s (units ms/s/m/h/d; compound and fractional allowed), OR
  • a bare number meaning fractional SECONDS — 60 = 60s, 60.5 = 60.5s (→ 60500 ms), 0.25 = 250 ms.

Distinct from crate::session::parse_duration, which is integer-only (whole seconds/minutes/…) and used for the session shelf-life cap. This parser is the convention for millisecond-resolution op/connection timeouts.

Functions§

parse_time_ms
Parse a user time value to whole milliseconds.