Function rcl_timer_get_time_since_last_call

Function Documentation

rcl_ret_t rcl_timer_get_time_since_last_call(const rcl_timer_t *timer, int64_t *time_since_last_call)

Retrieve the time since the previous call to rcl_timer_call() occurred.

This function calculates the time since the last call and copies it into the given int64_t variable.

Calling this function within a callback will not return the time since the previous call but instead the time since the current callback was called.

The time_since_last_call argument must be a pointer to an already allocated int64_t.

Attribute

Adherence

Allocates Memory

No

Thread-Safe

Yes

Uses Atomics

Yes

Lock-Free

Yes [1]

[1] if returns true for

Parameters:
  • timer[in] the handle to the timer which is being queried

  • time_since_last_call[out] the struct in which the time is stored

Returns:

RCL_RET_OK if the last call time was retrieved successfully, or

Returns:

RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or

Returns:

RCL_RET_TIMER_INVALID if the timer->impl is invalid, or

Returns:

RCL_RET_ERROR an unspecified error occur.