From e4547c30d121c3a2c7de731b815dd7685ae7554f Mon Sep 17 00:00:00 2001 From: Markus Kohlhase Date: Tue, 19 Sep 2023 11:58:44 +0200 Subject: [PATCH] Avoid breaking API change in public crate ofdb-entities --- ofdb-entities/src/time.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ofdb-entities/src/time.rs b/ofdb-entities/src/time.rs index e7bc6d97..8cbba7af 100644 --- a/ofdb-entities/src/time.rs +++ b/ofdb-entities/src/time.rs @@ -45,6 +45,11 @@ impl Timestamp { Ok(Self(date_time)) } + #[deprecated] + pub fn from_secs(seconds: i64) -> Self { + Self::try_from_secs(seconds).unwrap() + } + pub fn try_from_millis(milliseconds: i64) -> Result { let nanos = millis_to_nanos(milliseconds); let date_time = time::OffsetDateTime::from_unix_timestamp_nanos(nanos) @@ -52,6 +57,11 @@ impl Timestamp { Ok(Self(date_time)) } + #[deprecated] + pub fn from_millis(milliseconds: i64) -> Self { + Self::try_from_millis(milliseconds).unwrap() + } + pub fn as_secs(self) -> i64 { self.0.unix_timestamp() }