<div dir="ltr"><div><br></div><div class="gmail_extra">-void<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-Process::GetTimeUsage(<br>
- TimeValue& elapsed, TimeValue& user_time, TimeValue& sys_time)<br>
-{<br>
+void Process::GetTimeUsage(TimeValue &elapsed, TimeValue &user_time,<br>
+ TimeValue &sys_time) {<br>
elapsed = TimeValue::now();<br>
<br>
- uint64_t ProcCreate, ProcExit, KernelTime, UserTime;<br>
- GetProcessTimes(GetCurrentProcess(), (FILETIME*)&ProcCreate,<br>
- (FILETIME*)&ProcExit, (FILETIME*)&KernelTime,<br>
- (FILETIME*)&UserTime);<br>
+ FILETIME ProcCreate, ProcExit, KernelTime, UserTime;<br>
+ if (GetProcessTimes(GetCurrentProcess(), &ProcCreate, &ProcExit, &KernelTime,<br>
+ &UserTime) == 0)<br>
+ return;<br>
<br>
- // FILETIME's are # of 100 nanosecond ticks (1/10th of a microsecond)<br>
- user_time.seconds( UserTime / 10000000 );<br>
- user_time.nanoseconds( unsigned(UserTime % 10000000) * 100 );<br>
- sys_time.seconds( KernelTime / 10000000 );<br>
- sys_time.nanoseconds( unsigned(KernelTime % 10000000) * 100 );<br>
+ user_time = getTimeValueFromFILETIME(UserTime);<br>
+ sys_time = getTimeValueFromFILETIME(SystemTime);<br>
}<br><br></blockquote><div><br></div><div style>I think you meant KernelTime instead of SystemTime. </div></div><br></div></div>