bootc-internal-utils 1.16.13

Internal implementation component of bootc; do not use
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use anyhow::Context;

/// Try to parse an RFC 3339, warn on error.
pub fn try_deserialize_timestamp(t: &str) -> Option<chrono::DateTime<chrono::Utc>> {
    match chrono::DateTime::parse_from_rfc3339(t).context("Parsing timestamp") {
        Ok(t) => Some(t.into()),
        Err(e) => {
            tracing::warn!("Invalid timestamp in image: {:#}", e);
            None
        }
    }
}