Hello,

I would be very grateful for some help. I have a Visual C++ program and wish to time some critical sections of it. I followed the instructions by the MSDN library, but just get elapsed times of 0 or 1 second, so obviously something is wrong.

I've been doing the following:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

...........................

time_t start,finish;
double elapsed_time;

..........................

time(&start);
....................
// Lots of calculations
....................
time(&finish);
elapsed_time=difftime(finish,start);
fprintf(fpoutput,"Elapsed = %10.6f seconds\n",elapsed_time);

All I get printed in the output file is mostly 0 seconds, but occasionally 1 second, which makes no sense at all.

I also linked in the library LIBC.LIB, but this made no difference. Someone's help in this would be most appreciated - thank you.

Christopher Sharp