C语言的time函数
#include<time.h>
int fun() {
clock_t start,finish;
double time;
start = clock();
/*测试时间的代码*/
finish = clock();
time = (double)(finish - start)/CLOCKS_PER_SEC;// 精度为一毫秒
printf("time = %fseconds\n",time);
}
#include<time.h>
int fun() {
clock_t start,finish;
double time;
start = clock();
/*测试时间的代码*/
finish = clock();
time = (double)(finish - start)/CLOCKS_PER_SEC;// 精度为一毫秒
printf("time = %fseconds\n",time);
}