GetThreadTimes

This function obtains timing information about a specified thread.

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

Parameters

  • hThread
    [in] An open handle that specifies the thread whose timing information is sought. This handle must be created with THREAD_QUERY_INFORMATION access.
  • lpCreationTime
    [out] Long pointer to a FILETIME structure that receives the creation time of the thread.
  • lpExitTime
    [out] Long pointer to a FILETIME structure that receives the exit time of the thread. If the thread has not exited, the content of this structure is undefined.
  • lpKernelTime
    [out] Long pointer to a FILETIME structure that receives the amount of time that the thread has executed in kernel mode.
  • lpUserTime
    Pointer to a FILETIME structure that receives the amount of time that the thread has executed in user mode.

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.

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.

For Windows CE versions 2.10 through 2.12, support for GetThreadTimes is restricted as follows:

  • The lpCreationTime, lpExitTime, and lpKernelTime parameters are not supported. They are always returned as 0.
  • 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.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 2.10 and later Winbase.h   Coredll.lib, Nk.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

FILETIME

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.