PdhGetCounterTimeBase function (pdh.h)

Returns the time base of the specified counter.


PDH_FUNCTION PdhGetCounterTimeBase(
  [in]  PDH_HCOUNTER hCounter,
  [out] LONGLONG     *pTimeBase


[in] hCounter

Handle to the counter. The PdhAddCounter function returns this handle.

[out] pTimeBase

Time base that specifies the number of performance values a counter samples per second.

Return value

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, the return value is a system error code or a PDH error code. The following are possible values.

Return code Description
The specified counter does not use a time base.
The counter handle is not valid.


If you use the PdhFormatFromRawValue function to calculate a displayable value instead of calling the PdhCalculateCounterFromRawValue function, you must call the PdhGetCounterTimeBase function to retrieve the time base.

Each counter that returns time-based performance data has a time base defined for it. The time base of a counter is the number of times a counter samples data per second.


Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header pdh.h
Library Pdh.lib
DLL Pdh.dll

See also