The clock_gettime function requires a struct timespec object as an argument.
https://linux.die.net/man/3/clock_gettime
In the date and time utilities section of the C standard library, there is a function difftime which calculates the difference in two time_t objects.
https://en.cppreference.com/w/c/chrono
However there does not appear to be an equivalent function for struct timespec data.
I guess it is trivial to write one given that there are just two fields inside of a struct timespec (one for the number of seconds and one for the number of nanoseconds). However, it seems surprising that the standard library does not include this function for convenience.
Here is an example of how to do it:
(time_stop.tv_sec - time_start.tv_sec)
+ 1.0e-9 * (time_stop.tv_nsec - time_start.tv_nsec);
Does a function to find the difference in time between two struct timespec objects exist? Or is it perhaps not included because clock_gettime can be called with different arguments for different types of clock?