I'm trying to find out the time it takes for a function to execute in C. What i'm trying is the following:
#include <time.h> time_t start; time_t finish; double seconds; time(&start); FUNCTION time(&finish); seconds = difftime(finish,start); printf("Time taken is %.f", seconds); However, the returned value is always the same for different functions: 1389133144 seconds.
Any help? Thanks!
stdio.hthenprintfmay be implicitly prototyped to takeintarguments and casting your doubles lossily.