The gettimeofday() call returns microseconds.
Is this the most accurate method or is there a better way?
--EDIT--
I did a bit more snooping, and tried clock_gettime(CLOCK_MONOTONIC_RAW,&t1)
to get a timestamp. This appears to be reasonably accurate. Does anyone have any experience
with this to agree or disagree?
Thoughts?
Ed
Solved! Go to Solution.
Hi Ed
proper to use clock_gettime, see below
c - Measure time in Linux - getrusage vs clock_gettime vs clock vs gettimeofday? - Stack Overflow
https://blog.habets.se/2010/09/gettimeofday-should-never-be-used-to-measure-time
Best regards
chip
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Ed
proper to use clock_gettime, see below
c - Measure time in Linux - getrusage vs clock_gettime vs clock vs gettimeofday? - Stack Overflow
https://blog.habets.se/2010/09/gettimeofday-should-never-be-used-to-measure-time
Best regards
chip
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Chip,
Yep, that's what I ended up using. Shoulda posted it a while back.
Thanks,
Ed