Code: Select all
Procedure.i UptimePID(pid.i) ; second
creation.FILETIME
exit.FILETIME
kernel.FILETIME
user.FILETIME
stime.SYSTEMTIME
ltime.SYSTEMTIME;
h = OpenProcess_(#PROCESS_QUERY_INFORMATION, #False, pid)
If h
GetProcessTimes_(h,creation,exit,kernel,user)
FileTimeToSystemTime_(creation,stime);
SystemTimeToTzSpecificLocalTime_(#Null,stime,ltime);
ProcedureReturn Date() - Date(ltime\wYear,ltime\wMonth,ltime\wDay, ltime\wHour, ltime\wMinute, ltime\wSecond)
EndIf
ProcedureReturn 0
EndProcedure