diff --git a/openpgp-card/src/card_do/key_generation_times.rs b/openpgp-card/src/card_do/key_generation_times.rs index 1638083..cfc560c 100644 --- a/openpgp-card/src/card_do/key_generation_times.rs +++ b/openpgp-card/src/card_do/key_generation_times.rs @@ -13,7 +13,8 @@ use crate::Error; impl From for DateTime { fn from(kg: KeyGenerationTime) -> Self { - let naive_datetime = NaiveDateTime::from_timestamp(kg.0 as i64, 0); + let naive_datetime = NaiveDateTime::from_timestamp_opt(kg.0 as i64, 0) + .expect("invalid or out-of-range datetime"); DateTime::from_utc(naive_datetime, Utc) }