C语言是不是有date型
C语言是否有date型
C语言是否有date型
------解决思路----------------------
没有,只有一个tm结构体
------解决思路----------------------
可以通过这段代码获取当前时间:
C语言是否有date型
------解决思路----------------------
没有,只有一个tm结构体
------解决思路----------------------
可以通过这段代码获取当前时间:
#include <stdio.h>
#include <time.h>
#include <sys/timeb.h>
#include <windows.h>
int main(void)
{
struct tm *now;
struct timeb tb;
while (1)
{
ftime(&tb);
now = localtime(&tb.time);
printf("%04d-%02d-%02d,%02d:%02d:%02d-%03d\n", now->tm_year + 1900, now->tm_mon + 1, now->tm_mday, now->tm_hour, now->tm_min, now->tm_sec, tb.millitm);
Sleep(1000);
}
return 0;
}