编译环境为vs2013
ctime(); //这个函数就是把参数转化为当前时间
gmtime(); //取得UTC时间值,但是并不返回一个可以打印的字符串
asctime(); //获取一个字符串
#include <stdio.h>
#include <time.h> //这个函数包含时间所需要的文件
#include<stdlib.h> //这个函数是为了能够窗口能够暂停
#if 0
int main()
{
time_t NowTime;
time(&NowTime); //获取当前的时间(是秒数)
printf("NowTime = %s", ctime(&NowTime)); //NOw is chinese time
system("pause"); //让调试窗口可以保留
}
#else
{
//这个是打印程序的最长时间
time_t Max = 0x7fffffff; //这个就是除却符号位的最大值了
printf("Max = %s \n", asctime(gmtime(&Max))); //打印出来是就是程序的最久周期
system("pause");
}
#endif