Function rcutils_steady_time_now

Function Documentation

rcutils_ret_t rcutils_steady_time_now(rcutils_time_point_value_t *now)

Retrieve the current time as a rcutils_time_point_value_t object.

This function returns the time from a monotonically increasing clock. The closest equivalent would be to std::chrono::steady_clock::now();

The resolution (e.g. nanoseconds vs microseconds) is not guaranteed.

The now argument must point to an allocated rcutils_time_point_value_t object, as the result is copied into this variable.

Attribute

Adherence

Allocates Memory

No

Thread-Safe

Yes

Uses Atomics

No

Lock-Free

Yes

Parameters:

now[out] a struct in which the current time is stored

Returns:

RCUTILS_RET_OK if the current time was successfully obtained, or

Returns:

RCUTILS_RET_INVALID_ARGUMENT if any arguments are invalid, or

Returns:

RCUTILS_RET_ERROR if an unspecified error occur.