bootc_internal_utils/timestamp.rs
1use anyhow::Context;
2
3/// Try to parse an RFC 3339, warn on error.
4pub fn try_deserialize_timestamp(t: &str) -> Option<chrono::DateTime<chrono::Utc>> {
5 match chrono::DateTime::parse_from_rfc3339(t).context("Parsing timestamp") {
6 Ok(t) => Some(t.into()),
7 Err(e) => {
8 tracing::warn!("Invalid timestamp in image: {:#}", e);
9 None
10 }
11 }
12}