From 8afaf279b9b1cdcf3d5ea8bc433993eb3eb9659f Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 1 Aug 2023 18:25:47 +0200 Subject: [PATCH] timestamp --- docs/classes.rst | 4 ++++ include/zenohcxx/api.hxx | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/classes.rst b/docs/classes.rst index 5ad9b455..4475f7e0 100644 --- a/docs/classes.rst +++ b/docs/classes.rst @@ -38,6 +38,10 @@ The classes representing data buffers, data encoding, timestamp, etc. There type :members: :membergroups: Constructors Operators Methods +.. doxygenstruct:: zenoh::Timestamp + :members: + :membergroups: Constructors Operators Methods + Key Expressions --------------- diff --git a/include/zenohcxx/api.hxx b/include/zenohcxx/api.hxx index c9dbd5ca..f1373241 100644 --- a/include/zenohcxx/api.hxx +++ b/include/zenohcxx/api.hxx @@ -519,14 +519,24 @@ struct Encoding : public Copyable<::z_encoding_t> { bool operator!=(const Encoding& v) const { return !operator==(v); } }; -// -// Represents timestamp value in zenoh -// +/// Represents timestamp value in zenoh struct Timestamp : Copyable<::z_timestamp_t> { using Copyable::Copyable; // TODO: add utility methods to interpret time as mils, seconds, minutes, etc + + /// @name Methods + + /// @brief Get the time part of timestamp in NTP64 format + /// @return timestamp value uint64_t get_time() const { return time; } + + /// @brief Get the unique part of the timestamp + /// @return unique id z::Id get_id() const { return id; } + + /// @brief Check if the timestamp is valid + /// @return true if the timestamp is valid bool check() const { return ::z_timestamp_check(*this); } };