parse_time_spec

Function parse_time_spec 

Source
pub fn parse_time_spec(s: &str) -> Result<i64>
Expand description

Parses an absolute epoch timestamp or relative duration like “7d”, “24h”, “60m”.

Supports:

  • Raw epoch seconds (e.g. “1725846721”)
  • RFC 3339 / ISO 8601 date and time strings (e.g. “2026-09-09T01:52:01Z”, “2026-09-09”)
  • Relative duration strings (e.g. “7d”, “24h”, “60m”, “30s”, “1 week”) which are interpreted as being relative to current time (now - duration).

Note: Results may not be quite correct as it seems there is currently no Rust library that fully implements leap seconds.