Is there any way to check the granularity of gettimeofday() function provided by POSIX?
Is there any way to check the granularity of gettimeofday() function provided by POSIX?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Call it in a tight loop, note the difference between the current value and the previous one when it changes. Something like the following:
On my system it seems the granularity is around 2 usec (about 50/50 one or two microseconds, with outliers in the hundreds or thousands that are likely due to task switching).