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:
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?