#include
time_t now; //加 time_t 型
now=time(NULL); // 获取当前时间。
printf("%s",ctime(&now)); // 很容易输出。
加结构成员:
struct student
{ int id;
char name[100];
int score;
time_t now;
};
#include
clock_t currentTime = clock(); //获得从1970年1月1日到当前的毫秒数
具体函数百度查询time.h头文件即可