24-10-2007, 08:18 PM
Resolution is the frequency that the timer updates. For example, an output of a few counters:
Template code:
GetTickCount:
timeGetTime + timeBeginPeriod:
GetSystemTime:
And just for fun, QueryPerformanceCounter + QueryPerformanceFrequency:
Template code:
Code:
Private last
Private Sub Form_Load()
Dim i As Long
Dim r(0 To 9) As Double
Dim s As Double
Do While i < 10
r(i) = GetTime(GetTickCount)
If r(i) 0 Then
Debug.Print i & ". " & r(i)
i = i + 1
End If
Loop
For i = 1 To 9
s = s + Abs(r(i) - r(i - 1))
Next i
Debug.Print "Avg: " & (s / 9)
Unload Me
End
End Sub
Private Function GetTime(ByVal t)
If t last Then
GetTime = t
last = t
Else
GetTime = 0
End If
End Function
GetTickCount:
Code:
0. 6890312
1. 6890328
2. 6890343
3. 6890359
4. 6890375
5. 6890390
6. 6890406
7. 6890421
8. 6890437
9. 6890453
Avg: 14
timeGetTime + timeBeginPeriod:
Code:
0. 6954644
1. 6954645
2. 6954646
3. 6954647
4. 6954648
5. 6954649
6. 6954650
7. 6954651
8. 6954652
9. 6954653
Avg: 1
GetSystemTime:
Code:
0. 12837730444578.1
1. 12837730444593.8
2. 12837730444609.4
3. 12837730444625
4. 12837730444640.6
5. 12837730444656.3
6. 12837730444671.9
7. 12837730444687.5
8. 12837730444703.1
9. 12837730444718.8
Avg: 15.625
And just for fun, QueryPerformanceCounter + QueryPerformanceFrequency:
Code:
0. 7222.254
1. 7222.2542
2. 7222.2543
3. 7222.2545
4. 7222.2546
5. 7222.2547
6. 7222.2549
7. 7222.255
8. 7222.2551
9. 7222.2552
Avg: 1.33333333299864E-04