HANDLE process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID);
if (process != NULL){
FILETIME ftCreation, ftExit, ftKernel, ftUser;
SYSTEMTIME stCreation, lstCreation;
if (GetProcessTimes(process, &ftCreation, &ftExit, &ftKernel, &ftUser)) {
FileTimeToSystemTime(&ftCreation, &stCreation);
SystemTimeToTzSpecificLocalTime(NULL, &stCreation, &lstCreation);
}
CloseHandle(process);
}
GetProcessTimes获取到的是FILETIME,然后转成SYSTEMTIME,SYSTEMTIME是格林威治时间,北京时间是UTC+8,所以转换出来的时间会比电脑看到的时间少8小时
SystemTimeToTzSpecificLocalTime可以将SYSTEMTIME转换成当前系统时区时间