Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
561 B

  1. Attribute VB_Name = "Timer"
  2. Option Explicit
  3. Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As Currency) As Long
  4. Private Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As Currency) As Long
  5. Function HighResTimer() As Double
  6. Static secFreq As Currency, secStart As Currency
  7. If (secFreq = 0) Then QueryPerformanceFrequency secFreq
  8. QueryPerformanceCounter secStart
  9. If (secFreq <> 0) Then HighResTimer = secStart / secFreq
  10. ' Else Timer = 0 if no high resolution timer
  11. End Function