|
-
Jun 20th, 2000, 03:40 PM
#1
Thread Starter
Hyperactive Member
Even though the timer indicates is can operate down to 1ms intervals the best I can get it to achive is 50ms is this a common problem? Is there any way around it?
Cheers
-
Jun 20th, 2000, 04:00 PM
#2
I think the resolution is around 60ms
You could download the SubTimer from http://www.vbaccelerator.com for it has a smaller resolution.
-
Jun 20th, 2000, 04:02 PM
#3
Thread Starter
Hyperactive Member
I just found this in the help.
"The system generates 18 clock ticks per second — so even though the Interval property is measured in milliseconds, the true precision of an interval is no more than one-eighteenth of a second. "
This answers my question (1/18)sec = 55ms.
Cheers Azzmodan, I'll have a look on that site.
Rick
[Edited by Rick H on 06-21-2000 at 05:15 AM]
-
Jun 20th, 2000, 07:12 PM
#4
PowerPoster
Hi, Rick H Just take a look at this Thread
-
Jun 20th, 2000, 09:58 PM
#5
Thread Starter
Hyperactive Member
Chris, I`m not entirley sure on your test routine. I`ve adapted your code slightly to this:
Code:
Option Explicit
Private T1&, T2&, dl&
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Public Sub load_SetTimer()
SetTimer frmSome.hwnd, 0, 5, AddressOf TimerProc
T1 = GetTickCount
frmSome.txtoutput = ""
End Sub
Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long)
Static a As Integer
Static store(10) As Long
If a <= 10 Then
store(a) = GetTickCount
a = a + 1
Else
KillTimer frmSome.hwnd, 0
For a = 0 To 9
frmSome.txtoutput = frmSome.txtoutput & (store(a) - store(a + 1)) & vbCrLf
Next
a = 0
End If
End Sub
And these are the results I get:
-58
-52
-58
-52
-58
-52
-57
-53
-60
-53
indicating the same 55ms problem as before, this happens even if you change the interval from 5ms to 10ms. Do you think this is a problem with GetTickCount or the Settimer?
If you put 20ms as your interval you get 55ms exactly
Cheers
[Edited by Rick H on 06-21-2000 at 11:12 AM]
-
Jun 20th, 2000, 10:43 PM
#6
There was a debate about this awhile ago. The QueryPerformanceCounter is the most accurate one. 1 microsecond.
-
Jun 20th, 2000, 11:36 PM
#7
transcendental analytic
Yeah but that depends on the machine, i tested out the multimedia timer, that raised an event each millisecond, but it crashed as soon as you started to use your keyboard or mouse...
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 21st, 2000, 03:28 AM
#8
So I guess GetTickCount is the most stable one.
-
Jun 21st, 2000, 04:33 AM
#9
transcendental analytic
I don't think there's particulary stable or unstable api functions since they all work fine but what i meant was stable events raised by timers.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|