the suggested method of estimating the time is using the clock() function and then dividing the count of cpu cycles by cycles/second.
My problem is that the program i am trying to run takes a lot of time (in hours). This means the clock() function (that returns a long int) returns a garbage value (because max long int is not big enough for this)
Any suggestions (apart from estimating time for internal loops and adding them up or something) ?
long t1 = clock();
function();
long t2=clock();
time = ((double)t2 - t1) / CLOCKS_PER_SEC
If the program is long running then sub-second accuracy is probably not particularly important. In that case, why not just call time()
?