Timeval struct usage
问题 I needed to calculate the time it takes to run a certain function and ran into the following code,record & output the execution time of a piece of code in nanoseconds And also is there any difference between struct timeval timer_spent & timeval timer_spent /* Put this line at the top of the file: */ #include <sys/time.h> /* Put this right before the code you want to time: */ struct timeval timer_start, timer_end; gettimeofday(&timer_start, NULL); /* Put this right after the code you want to