I found this site


If I have a server-client code and this:

clock_gettime(CLOCK_REALTIME, &time_a); // create socket
clock_gettime(CLOCK_REALTIME, &time_b); // close socket

If I have a and b wand want to measure the time it takes to communicate, what's the best way ? Still not fully understanding the exact difference between


And there are a few others.

if you have a compiler that support c++11 check this out. It will show you how to use the high resolution clock available in c++11.

Thank you. So it dosen't really matter which one I use ? I don't understand the difference.

Well the different choices are for which clock to use. CLOCK_REALTIME uses the full system time. CLOCK_PROCESS_CPUTIME_ID uses the time in the process and CLOCK_THREAD_CPUTIME_ID uses the time from the thread. If you have c++11 I would really suggest using the high resolution clock from the chrono header.