bootc_internal_utils/
timestamp.rs

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