Skip to main content

iso_to_epoch

Function iso_to_epoch 

Source
pub fn iso_to_epoch(s: &str) -> Result<u64, String>
Expand description

Parse an ISO-8601 / RFC 3339 timestamp into Unix-epoch seconds.

Accepts the formats pylon emits (epoch_to_iso shape) plus the common RFC 3339 variants users send through the API:

  • YYYY-MM-DDTHH:MM:SSZ
  • YYYY-MM-DDTHH:MM:SS.fffZ (fractional seconds dropped)
  • YYYY-MM-DDTHH:MM:SS+HH:MM / -HH:MM (offset applied)

Hand-rolled to keep pylon-kernel std-only — no chrono dep. Used by the Postgres adapter to bind TIMESTAMPTZ columns from JSON strings; SQLite stores them as TEXT and never needed parsing.