vbAccelerator - Contents of code file: mTiming.bas

Attribute VB_Name = "mTiming"
Option Explicit

'
' mTiming.bas
'
' Timing routine for debuging purposes.
' Has 1ms accuracy, therefore "lame" benchmarks
' according to one VB web site.
'
' vbAccelerator says
' "If you need to time shorter than 1ms then you
' are timing the wrong thing."
'

Declare Function timeBeginPeriod Lib "winmm.dll" (ByVal uPeriod As Long) As Long
Declare Function timeEndPeriod Lib "winmm.dll" (ByVal uPeriod As Long) As Long
Declare Function timeGetTime Lib "winmm.dll" () As Long

Private m_lT As Long

Public Sub StartTiming()
   timeBeginPeriod 1
   m_lT = timeGetTime
End Sub
Public Function EndTiming() As Long
   EndTiming = timeGetTime - m_lT
   timeEndPeriod 1
End Function