GetLocalTime
CString timeStr; // 获取系统时间
SYSTEMTIME sysTime;
GetLocalTime(&sysTime);
timeStr.Format(L"_%4d.%2d.%2d_%2d.%2d",
sysTime.wYear, sysTime.wMonth,
sysTime.wDay, sysTime.wHour, sysTime.wMinute);
time & localtime
CString strPath = _T("D:\\RunningTime.txt");
std::wofstream ofile(strPath, std::ios::out | std::ios::app);
time_t rawtime;
struct tm* info;
time(&rawtime);
info = localtime(&rawtime);
ofile << LPCTSTR(_T("process1: ")) << asctime(info) << endl;