程序
#include <iostream>
#include <ctime>
#include<windows.h>
#pragma warning(disable:4996)
int main()
{
time_t timer = time(NULL);
struct tm *tblock = localtime(&timer);
printf("[%04d-%02d-%02d %02d:%02d:%02d] \n",
tblock->tm_year + 1900, tblock->tm_mon + 1, tblock->tm_mday,
tblock->tm_hour, tblock->tm_min, tblock->tm_sec);
SYSTEMTIME lpsystime1;
GetLocalTime(&lpsystime1);
printf("[%04d-%02d-%02d %02d:%02d:%02d.%03ld] \n", lpsystime1.wYear, lpsystime1.wMonth, lpsystime1.wDay, lpsystime1.wHour, lpsystime1.wMinute, lpsystime1.wSecond, lpsystime1.wMilliseconds);
system("pause");
return 0;
}