Template Function rclcpp::detail::safe_cast_to_period_in_ns

Function Documentation

template<typename DurationRepT, typename DurationT>
std::chrono::nanoseconds rclcpp::detail::safe_cast_to_period_in_ns(std::chrono::duration<DurationRepT, DurationT> period)

Perform a safe cast to a timer period in nanoseconds.

Template Parameters:
  • DurationRepT

  • DurationT

Parameters:

period – period to execute callback. This duration must be 0 <= period < nanoseconds::max()

Throws:

std::invalid_argument – if period is negative or too large

Returns:

period, expressed as chrono::duration::nanoseconds