GetThreadTimes

This function obtains timing information about a specified thread.

At a Glance

Header file: Winbase.h
Windows CE versions: 2.10 and later

Syntax

BOOL GetThreadTimes (HANDLE hThread, LPFILETIME lpCreationTime,
LPFILETIME lpExitTime, LPFILETIME lpKernelTime,
LPFILETIME lpUserTime);

Parameters

hThread

An open handle that specifies the thread whose timing information is sought.

lpCreationTime

Unsupported; set to zero.

lpExitTime

Unsupported; set to zero.

lpKernelTime

Unsupported; set to zero.

lpUserTime

Pointer to a FILETIME structure that receives the amount of time that the thread has executed in user mode.

The lpUserTime parameter reports the total time a thread has been running. There is no distinction between user and kernel modes. The lpUserTime parameter is no longer valid when the thread exits.

Return Values

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

All times are expressed using FILETIME data structures. Such a structure contains two 32-bit values that combine to form a 64-bit count of 100-nanosecond time units.

Thread creation and exit times are points in time expressed as the amount of time that has elapsed since midnight on January 1, 1601 at Greenwich, England. The Win32 API provides several functions that an application can use to convert such values to more generally useful forms; see Time and Date Functions, and the functions noted in the following See Also section.

Thread kernel mode and user mode times are amounts of time. For example, if a thread has spent one second in kernel mode, this function will fill the FILETIME structure specified by lpKernelTime with a 64-bit value of ten million. That is the number of 100-nanosecond units in one second.