SO right now I'm programming some sorting algorithms and finding their actual running time....
To do this, I'm doing something like this:
time1=(clock()/CLOCKS_PER_SEC)*pow(10,3); // time in milliseconds
heapSort(temp,n);
time2=(clock()/CLOCKS_PER_SEC)*pow(10,3);
actualtime=time2-time1;
printf("This took %f\n",actualtime);
where actualtime, time2, and time1 are all floats
However, when I do this, I keep on getting 0 as the output. I think that my code is correct. Why would I get 0 as the running time?
To do this, I'm doing something like this:
time1=(clock()/CLOCKS_PER_SEC)*pow(10,3); // time in milliseconds
heapSort(temp,n);
time2=(clock()/CLOCKS_PER_SEC)*pow(10,3);
actualtime=time2-time1;
printf("This took %f\n",actualtime);
where actualtime, time2, and time1 are all floats
However, when I do this, I keep on getting 0 as the output. I think that my code is correct. Why would I get 0 as the running time?
