Programmatically compute the start time of a process on Windows

后端 未结 2 447
死守一世寂寞
死守一世寂寞 2021-01-06 20:26

I\'m writing c/c++ code on Windows using Visual Studio. I want to know how to calculate the start time of my process effectively. Can I just use gettimeofday()? I\'ve fou

2条回答
  •  有刺的猬
    2021-01-06 20:51

    If I understand you right you want to know what time your process started, correct? So you'll want to look into GetProcessTimes

    If the process you're interested in is the current process, you can use GetCurrentProcess() to get the process handle that you'll need to call GetProcessTimes() this returns a pseudo-handle that you don't need to close.

提交回复
热议问题