[ros-users] [Discourse.ros.org] [Next Generation ROS] ROS 2 …

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Sloretz via ros-users
Date:  
To: ros-users
CC: Sloretz
Subject: [ros-users] [Discourse.ros.org] [Next Generation ROS] ROS 2 Time vs std::chrono


If I understand correctly, I think the issue is that the [`std::chrono` clock requirements](https://en.cppreference.com/w/cpp/named_req/Clock) don't allow `now()` to be a non-static member function. `ros2_node_clock::now()` has to be `static` and could not access `m_clock`.

A while ago I did try prototyping a clock that conformed to the `std::chrono` requirements except with a non-static member `now()`. Not all C++ API's allow this. For example [`std::thread::sleep_until()`](https://en.cppreference.com/w/cpp/thread/sleep_until) tries to call `clock::now()` on the time point passed into it. I gave up because whether or not an API calls `clock::now()` in its implementation is undefined behavior.





---
[Visit Topic](https://discourse.ros.org/t/ros-2-time-vs-std-chrono/6293/6) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list

http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>