From 16bd0f09568211a2a12c836803dee0f91e681ade Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 5 Feb 2023 20:27:50 +0100 Subject: [PATCH] use regular UnixTimestamp ctor --- src/time/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/time/mod.rs b/src/time/mod.rs index 419d601..2947d7c 100644 --- a/src/time/mod.rs +++ b/src/time/mod.rs @@ -223,10 +223,10 @@ pub trait CcsdsTimeProvider { fn unix_seconds(&self) -> i64; fn subsecond_millis(&self) -> Option; fn unix_stamp(&self) -> UnixTimestamp { - UnixTimestamp { - unix_seconds: self.unix_seconds(), - subsecond_millis: self.subsecond_millis(), + if self.subsecond_millis().is_none() { + return UnixTimestamp::new_only_seconds(self.unix_seconds()); } + UnixTimestamp::const_new(self.unix_seconds(), self.subsecond_millis().unwrap()) } fn date_time(&self) -> Option>;