static void record_times( HANDLE const process, timing_info * const time ) { FILETIME creation; FILETIME exit; FILETIME kernel; FILETIME user; if ( GetProcessTimes( process, &creation, &exit, &kernel, &user ) ) { time->system = filetime_to_seconds( kernel ); time->user = filetime_to_seconds( user ); timestamp_from_filetime( &time->start, &creation ); timestamp_from_filetime( &time->end, &exit ); } }
void timestamp_current( timestamp * const t ) { #ifdef OS_NT /* GetSystemTimeAsFileTime()'s resolution seems to be about 15 ms on Windows * XP and under a millisecond on Windows 7. */ FILETIME ft; GetSystemTimeAsFileTime( &ft ); timestamp_from_filetime( t, &ft ); #else /* OS_NT */ timestamp_init( t, time( 0 ), 0 ); #endif /* OS_NT */ }