__1. timeGetTime() is more accurate. The Timer() Function measure time in 'seconds' since Midnight in a single-precision floating-point value, and is not terribly accurate. timeGetTime() returns the number of 'milliseconds' that have elapsed since Windows has started and is very accurate.
__2. timeGetTime() runs longer without 'rolling over'. Timer() rolls over every 24 hours. timeGetTime() keeps on ticking for up to 49 days before it resets the returned tick count to 0.
__3. Calling timeGetTime() is significantly faster than calling Timer().
__4. Calling timeGetTime() is no more complex than calling Timer(), once you've included the proper declaration as in:
Expand|Select|Wrap|Line Numbers
- Public Declare Function timeGetTime Lib "winmm.dll" () As Long
Expand|Select|Wrap|Line Numbers
- Dim lngCounter As Long, dblSqr As Double
- Dim StartTime As Long, EndTime As Long
- StartTime = timeGetTime()
- For lngCounter = 1 To 20000000
- dblSqr = Sqr(intCounter)
- Next
- EndTime = timeGetTime()
- Debug.Print "It took " & (EndTime - StartTime) / 1000 & " seconds to process this loop"
It took 1.316 seconds to process this loop