diff --git a/x509-tsp/src/generalized_time_nanos.rs b/x509-tsp/src/generalized_time_nanos.rs index ec9fba283..2e48863d8 100644 --- a/x509-tsp/src/generalized_time_nanos.rs +++ b/x509-tsp/src/generalized_time_nanos.rs @@ -49,6 +49,14 @@ impl GeneralizedTimeNanos { nanoseconds: unix_duration.subsec_nanos(), }) } + + /// Convert this [`GeneralizedTimeNanos`] into a [`DateTime`]. + /// + /// Note: This looses the nanoseconds precision. + #[must_use] + pub const fn to_date_time(&self) -> DateTime { + self.datetime + } } impl From for GeneralizedTimeNanos {