Hi,
I am using the clock() function to time an operation entitled cycleThroughPermutations.
I have used it for the start and end time. However, I get negative times when the process takes a while.
My code is below.
I think it may have something to do with the clock() function. When I used the following code, I never had this probelm.PHP Code:
/* cycle through the permutations and keep time, parameters include distance matrix, dimensions of graph, shortest cycle pointer, least distance measure, staring perm list and stop index */
startTime = clock();
cycleThroughPermutations(distanceMatrix, dimensionsOfGraph, shortestCycle, &leastDistanceMeasure, permList, leaveAloneIndex);
endTime = clock();
timeDifference = (double)(endTime - startTime)/(double)CLOCKS_PER_SEC;
Can someone explain what is the problem?PHP Code:time(&startTime);
cycleThroughPermutations(distanceMatrix, dimensionsOfGraph, shortestCycle, &leastDistanceMeasure, permList, -1);
time(&endTime);
timeDifference = difftime(endTime,startTime);
Thanks in advance.



LinkBack URL
About LinkBacks


