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转换成当前系统时区时间

相关文章:

  • 2022-12-23
  • 2021-09-23
  • 2021-11-28
  • 2022-03-08
  • 2021-07-29
  • 2021-12-16
  • 2021-07-06
猜你喜欢
  • 2022-02-14
  • 2022-12-23
  • 2021-06-20
  • 2021-11-09
  • 2021-12-04
  • 2022-02-08
  • 2021-10-28
相关资源
相似解决方案