Template Function rcpputils::convert_to_nanoseconds

Function Documentation

template<typename DurationRepT, typename DurationT>
std::chrono::nanoseconds rcpputils::convert_to_nanoseconds(const std::chrono::duration<DurationRepT, DurationT> &time)

Convert to std::chrono::nanoseconds.

This function help to convert from std::chrono::duration to std::chrono::nanoseconds and throw exception if overflow occurs while coverting.

Parameters:

time[in] The time to be converted to std::chrono::nanoseconds.

Throws:

std::invalid_argument – if time is bigger than std::chrono::nanoseconds::max() or less than std::chrono::nanoseconds::min().

Returns:

std::chrono::nanoseconds.