If your functions are not very slow, you will need a timer with a very high resolution. The most accurate I know is QueryPerformanceCounter . Google for more information. Try clicking the following in the class, name it CTimer say, then you can make the instance somewhere global and just call .StartCounter and .TimeElapsed
Option Explicit Private Type LARGE_INTEGER lowpart As Long highpart As Long End Type Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As LARGE_INTEGER) As Long Private Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As LARGE_INTEGER) As Long Private m_CounterStart As LARGE_INTEGER Private m_CounterEnd As LARGE_INTEGER Private m_crFrequency As Double Private Const TWO_32 = 4294967296
Mike Woodhouse Oct 13 '08 at 19:16 2008-10-13 19:16
source share