计时单位用秒:
#include <time.h>
time_t start = time( NULL );
....
printf( "消耗了%d秒/n ", time(NULL) - start );
计时单位用豪秒:
#include <time.h>
struct timeb start, end;
ftime( &start );
....
ftime( &end );
printf( "消耗了%d.%03u秒/n ", end.time - start.time, end.millitm - start.millitm );
#include <time.h>
time_t start = time( NULL );
....
printf( "消耗了%d秒/n ", time(NULL) - start );
计时单位用豪秒:
#include <time.h>
struct timeb start, end;
ftime( &start );
....
ftime( &end );
printf( "消耗了%d.%03u秒/n ", end.time - start.time, end.millitm - start.millitm );