#include<stdio.h>
#include<time.h>
#include<windows.h>
#include<stdlib.h>
main()
{
clock_t t1,t2;
time_t now;
time(&now);
printf("It is now %s",ctime(&now));
t1=clock(); //起始时间
for(int i=10;i>=1;i--)
{
printf("%2d/n",i);
Sleep(1000);
}
t2=clock(); //结束时间
printf("%.2f/n",(t2-t1)/CLK_TCK); //CLK_TCK=1000
time(&now);
printf("It is now %s",ctime(&now));
printf("The strlen is %d/n",strlen((ctime(&now))));
system("pause");
}
time_t输出时间
C语言时间与计时
最新推荐文章于 2025-05-10 18:36:12 发布
1万+

被折叠的 条评论
为什么被折叠?



