KeQueryInterruptTime routine

The KeQueryInterruptTime routine returns the current value of the system interrupt time count, with accuracy to within system clock tick.


ULONGLONG KeQueryInterruptTime(void);


This routine has no parameters.

Return value

KeQueryInterruptTime returns the current interrupt-time count in 100-nanosecond units. The update to this return value generally occurs at least once per system clock tick.


This routine returns the system interrupt time, which is the amount of time since the operating system was last started. The interrupt-time count begins at zero when the operating system starts and is incremented at each clock interrupt by the length of a clock tick. For various reasons, such as hardware differences, the length of a system clock tick can vary between computers. Call the KeQueryTimeIncrement routine to determine the size of a system clock tick.

Note  The preceding remarks describe the behavior of KeQueryInterruptTime in free (or retail) builds of Windows. In checked (or debug) builds, this behavior is modified to help developers to identify bugs that might not occur until the operating system has been running for many days without being restarted. Specifically, the interrupt-time count and tick count in checked builds are advanced by approximately 49 days. For more information about checked and free builds, see Checked and Free Build Differences.

KeQueryInterruptTime can be used for performance tuning. This routine returns a finer grained measurement than the KeQueryTickCount routine. A call to KeQueryInterruptTime has considerably less overhead than a call to the KeQueryPerformanceCounter routine, as well.

Consequently, interrupt time can be used to measure very fine-grained durations while the system is running because operations that set or reset the system time have no effect on the system interrupt time count.

However, power-management state changes do affect the system interrupt time count. Maintenance of the interrupt time count is suspended during system sleep states. When a subsequent wake state transition occurs, the system adds a "bias" value to the interrupt time count to compensate for the estimated duration of such a sleep state. The interrupt time count that is returned by KeQueryInterruptTime includes this bias value. To obtain an unbiased interrupt time count, use the KeQueryUnbiasedInterruptTime routine instead of KeQueryInterruptTime.


Target platform



Available starting with Windows 2000.


Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)






Any level

See also

Acquiring high-resolution time stamps



Send comments about this topic to Microsoft