Hey Folks. Question here. I am writing a program in C++ in linux. I need to time a piece of code. Currently I am using the times function in <sys/times.h>. It gets me the time alright (time differece between start and end of code segment). However, I need a greater accuracy (3 decimal places at least). I want the same degree of accuracy as when I run the "time <progname>" command. For example, for one of my programs the output was:
real 0m0.067s
user 0m0.064s
sys 0m0.004s
when using the "time <programname>. When using times function within my program I get the following: 0.07. If I increase the precision of the output, they are just zeros. Is there any way to have the same degree of accuracy as a "time" command?