QueryInterruptTime function (realtimeapiset.h)

Gets the current interrupt-time count. For a more precise count, use QueryInterruptTimePrecise.

Syntax

void QueryInterruptTime(
  [out] PULONGLONG lpInterruptTime
);

Parameters

[out] lpInterruptTime

A pointer to a ULONGLONG in which to receive the interrupt-time count in system time units of 100 nanoseconds. Divide by ten million, or 1e7, to get seconds (there are 1e9 nanoseconds in a second, so there are 1e7 100-nanoseconds in a second).

Return value

None

Remarks

The interrupt-time count begins at zero when the system starts and is incremented at each clock interrupt by the length of a clock tick. The exact length of a clock tick depends on underlying hardware and can vary between systems.

Unlike system time, the interrupt-time count is not subject to adjustments by users or the Windows time service. Applications can use the interrupt-time count to measure finer durations than are possible with system time. Applications that require greater precision than the interrupt-time count should use a high-resolution timer. Use the QueryPerformanceFrequency function to retrieve the frequency of the high-resolution timer and the QueryPerformanceCounter function to retrieve the counter's value.

The timer resolution set by the timeBeginPeriod and timeEndPeriod functions affects the resolution of the QueryInterruptTime function. However, increasing the timer resolution is not recommended because it can reduce overall system performance and increase system power consumption by preventing the processor from entering power-saving states. Instead, applications should use a high-resolution timer.

Note  The QueryInterruptTime function produces different results on debug ("checked") builds of Windows, because the interrupt-time count and tick count are advanced by approximately 49 days. This helps to identify bugs that might not occur until the system has been running for a long time. The checked build is available to MSDN subscribers through the Microsoft Developer Network (MSDN) Web site.
 
To compile an application that uses this function, define _WIN32_WINNT as 0x0601 or later. For more information, see Using the Windows Headers.

Requirements

Requirement Value
Minimum supported client Windows 10 [desktop apps | UWP apps]
Minimum supported server Windows Server 2016 [desktop apps | UWP apps]
Target Platform Windows
Header realtimeapiset.h
Library Mincore.lib
DLL Kernel32.dll

See also

Interrupt Time

QueryInterruptTimePrecise

QueryUnbiasedInterruptTime

QueryUnbiasedInterruptTimePrecise

System Power States

Windows Time