Skip to content

Commit

Permalink
timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Aug 1, 2023
1 parent 9397e5d commit 8afaf27
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------------

Expand Down
16 changes: 13 additions & 3 deletions include/zenohcxx/api.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a
/// href=https://docs.rs/zenoh/0.7.2-rc/zenoh/time/struct.NTP64.html>NTP64</a> 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); }
};

Expand Down

0 comments on commit 8afaf27

Please sign in to comment.