Function rc_timespec_diff#

Function Documentation#

timespec rc_timespec_diff(timespec A, timespec B)#

Returns the time difference between two timespec structs as another timespec.

Convenient for use with nanosleep() function and accurately timed loops. Unlike timespec_sub defined in time.h, rc_timespec_diff does not care which came first, A or B. A positive difference in time is always returned.

Parameters:
  • A[in] timespec struct

  • B[in] timespec struct

Returns:

timespec struct of the difference, always positive