From 36256f3d8f0a11fe0917841ffa7557f2f03e48c4 Mon Sep 17 00:00:00 2001 From: Julien Enoch Date: Mon, 18 Sep 2023 11:10:51 +0200 Subject: [PATCH] Add Timestamp.get_time --- src/value.rs | 4 ++++ zenoh/value.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/value.rs b/src/value.rs index 26ae8721..24fba452 100644 --- a/src/value.rs +++ b/src/value.rs @@ -194,6 +194,10 @@ impl _Timestamp { } } #[getter] + pub fn get_time(&self) -> PyResult { + Ok(self.0.get_time().0) + } + #[getter] pub fn seconds_since_unix_epoch(&self) -> PyResult { Ok(self.0.get_time().as_secs_f64()) } diff --git a/zenoh/value.py b/zenoh/value.py index d1bcd723..6446f52a 100644 --- a/zenoh/value.py +++ b/zenoh/value.py @@ -114,6 +114,12 @@ class Timestamp(_Timestamp): def _upgrade_(this: _Timestamp) -> 'Timestamp': return _Timestamp.__new__(Timestamp, this) @property + def get_time(self) -> int: + """ + Returns the time part, as generated by the Zenoh HLC in NTP64 format (See https://datatracker.ietf.org/doc/html/rfc5905#section-6). + """ + return super().time + @property def seconds_since_unix_epoch(self) -> float: """ Returns the number of seconds since the Unix Epoch.