pub fn epoch_seconds(stamp: &str) -> Option<i64>Expand description
Seconds since the epoch of an RFC 3339 UTC stamp as this crate writes them
(2026-10-01T09:30:00Z, optionally with fractional seconds). None for anything else:
a stamp that cannot be read is not guessed at.
use majordomus_cli::reasoning::epoch_seconds;
assert_eq!(epoch_seconds("1970-01-01T00:00:00Z"), Some(0));
assert_eq!(epoch_seconds("2026-10-01T00:00:10Z"), Some(1_790_812_810));
assert_eq!(epoch_seconds("2026-10-01T00:00:10.25Z"), Some(1_790_812_810));
assert_eq!(epoch_seconds("yesterday"), None);