diff --git a/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp b/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp index 18253fa3..922a80fb 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp @@ -83,6 +83,13 @@ std::chrono::nanoseconds::rep ZenohReply::get_received_timestamp() const return received_timestamp_; } +int64_t get_system_time_in_ns() +{ + auto now = std::chrono::system_clock::now().time_since_epoch(); + return std::chrono::duration_cast(now).count(); +} + +///============================================================================= Payload::Payload(const zenoh::Bytes & bytes) { // NOTE(fuzzypixelz): `zenoh::Bytes` is an list of reference-couted buffers. When the list of diff --git a/rmw_zenoh_cpp/src/detail/zenoh_utils.hpp b/rmw_zenoh_cpp/src/detail/zenoh_utils.hpp index 734ade92..58ed471d 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_utils.hpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_utils.hpp @@ -69,6 +69,8 @@ class ZenohQuery final std::chrono::nanoseconds::rep received_timestamp_; }; +int64_t get_system_time_in_ns(); + class Payload { public: