获得系统时间

1、使用CTime精确到秒

CTime time = CTime::GetCurrentTime();

CString time_str;

time_str.Format(_T("%d-%d-%d-%d"),time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute());//

2、使用GetLocalTime精确到毫秒

SYSTEMTIME lpSystemTime;//精确到毫秒
GetLocalTime(&lpSystemTime);
CString time_str;
time_str.Format(_T("%02d-%02d-%03d:"),lpSystemTime.wMinute,lpSystemTime.wSecond,lpSystemTime.wMilliseconds);

原文地址:https://www.cnblogs.com/judes/p/6292767.html