double get_time(){ struct timeval t; gettimeofday(&t, NULL); double d = t.tv_sec + (double) t.tv_usec/1000000; return d;}...double time_start = get_time();...double time_end = get_time();printf("This program has run for: %f seconds.\n", time_end - time_start); #include#include void do_something(){ for(int i=0;i<100000;i++) for(int j=0;j<10000;j++) ;}int main(int arg,char ** argv){ clock_t start=clock(); do_something(); clock_t end=clock(); float time=(float)(end-start)/CLOCKS_PER_SEC; printf("%f\n",time); return 0;}