Leaked source code of windows server 2003
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.

18 lines
755 B

  1. Attribute VB_Name = "Module1"
  2. Public Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As LARGE_INTEGER) As Long
  3. Public Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As LARGE_INTEGER) As Long
  4. Public Type LARGE_INTEGER
  5. lowpart As Long
  6. highpart As Long
  7. End Type
  8. Public Function getSecondsDifference(tstStart As LARGE_INTEGER, tstEnd As LARGE_INTEGER) As Double
  9. Dim liFreq As LARGE_INTEGER
  10. Dim dResult As Double
  11. Call QueryPerformanceFrequency(liFreq)
  12. dResult = (tstEnd.highpart * 2 ^ 32 + tstEnd.lowpart) - (tstStart.highpart * 2 ^ 32 + tstStart.lowpart)
  13. getSecondsDifference = dResult / (liFreq.highpart * 2 ^ 32 + liFreq.lowpart)
  14. End Function