RE: Using GetProcessTimes
I was just looking into MSDN and i found one piece of code which could help
but i am not sure about its outcome.
FILETIME ftCreate={0}, ftExit, ftKernel, ftUser;
SYSTEMTIME stUTC = {0}, stLocal={0}, stLocal2;
if(GetProcessTimes(hnd,&ftCreate,&ftExit,&ftKernel,&ftUser)==0)
{
cout<<"Error "<<GetLastError()<<endl;
}
else
{
FileTimeToSystemTime(&ftCreate, &stUTC);
SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);
cout<<stLocal.wSecond<<endl;
}
Now to try this code.....i start a process then call Sleep(15000) and then
this code gets executed. Everytime i run it, i get different
numbers.......for e.g., 16,31,43 etc....It shouldnt be 16 everytime since
process is created 15 seconds back. Can anyone tell what is going on and how
to retrieve the process creation correctly
kunal
"kunal s patel" wrote:
Hi all,
In my application, i want to know how much time a process has run since its
starting. So for that i am using this api. Now this Api returns time in
FILETIME structure. I want to retrieve time as..how much
seconds/minutes/hours this process has been running........how do i go about
it.
kunal