15 #ifndef RCLCPP__TIME_HPP_ 16 #define RCLCPP__TIME_HPP_ 20 #include "builtin_interfaces/msg/time.hpp" 32 template<rcl_time_source_type_t ClockT = RCL_SYSTEM_TIME>
39 throw std::runtime_error(
"RCL_ROS_TIME is currently not implemented.");
48 ret,
"Could not get current time: ");
51 return Time(std::move(rcutils_now));
54 operator builtin_interfaces::msg::Time()
const 56 builtin_interfaces::msg::Time msg_time;
57 msg_time.sec =
static_cast<std::int32_t
>(
RCL_NS_TO_S(rcl_time_));
58 msg_time.nanosec =
static_cast<std::uint32_t
>(rcl_time_ % (1000 * 1000 * 1000));
66 : rcl_time_(std::forward<decltype(rcl_time)>(rcl_time))
72 #endif // RCLCPP__TIME_HPP_
rcutils_ret_t rcutils_system_time_now(rcutils_time_point_value_t *now)
Definition: allocator_common.hpp:24
rcutils_time_point_value_t rcl_time_point_value_t
void throw_from_rcl_error(rcl_ret_t ret, const std::string &prefix="", const rcl_error_state_t *error_state=nullptr, void(*reset_error)()=rcl_reset_error)
Throw a C++ std::exception which was created based on an rcl error.
rcutils_ret_t rcutils_steady_time_now(rcutils_time_point_value_t *now)
static Time now()
Definition: time.hpp:34
#define RCUTILS_RET_ERROR
uint64_t rcutils_time_point_value_t