#include "time.h"
#include "sys/time.h"
long long time1;
long long time2;
double usetime;
struct timeval tim;
/**********开始时间********************/
gettimeofday(&tim,NULL);
printf("start: %lld \n",tim.tv_sec*1000 + tim.tv_usec/1000);
time1 =tim.tv_sec*1000 + tim.tv_usec/1000;
/**********结束时间********************/
gettimeofday(&tim,NULL);
printf("end: %lld \n",tim.tv_sec*1000 + tim.tv_usec/1000);
time2 =tim.tv_sec*1000 + tim.tv_usec/1000;
/**********计算********************/
usetime = time2-time1;
printf("加密所用时间 %.3f s\n",usetime/1000);
c 计算时间
于 2024-04-30 14:27:00 首次发布