>>>I know this has been discussed many times before but I do not fully understand yet. I have read about timers and how inaccurate they are. It appears that if left alone they do have good resolution though. I downloaded cpptimer and ran the test. It reported a resolution of 20.7469ms on my system. So I adapted the included test code and ran it with a vfp timer. Then it reported a resolution of .9369ms. To me this says that the timer works pretty good at least if you do not interrupt it. Did I make an error in my code or understanding?
>>>
>>>tt=CREATEOBJECT('timertest')
>>>wait window "Counting, please DO NOT press a key!" timeout 5
>>>?
>>>?"Available resolution: ",5000/tt.tics,"ms Timer tics:",tt.tics
>>>?
>>>RELEASE tt
>>>
>>>DEFINE CLASS timertest as Timer
>>>
>>> interval=1
>>> tics=0
>>>
>>> PROCEDURE timer
>>> this.tics=this.tics+1
>>> ENDPROC
>>>
>>>ENDDEFINE
>>>
>>___________
>>Joe,
>>
>>A couple of things
>>(1) in the timer event disable the timer on entry and enable it again on exit
>
>What effect does this have?
I always do to avoid another timer during a timer event
>
>>
>>>DEFINE CLASS timertest as Timer
>>>
>>> interval=1
>>> tics=0
>>>
>>> PROCEDURE timer
>> this.Enabled = .f.
>>
>>> this.tics=this.tics+1
>>
>> this.enabled = .t.
>>
>>> ENDPROC
>>>
>>>ENDDEFINE
>>
>>
>>(2) When the timer fires depends on how busy foxpro is at that moment. It may skip a few events and later fire them all at once
>
>I understand that.
>
>>(3) do not use a resolution of 1 ms. You may end up killing the system
>
>Killing it in what way?
Spending resources for nothing - do you really need a 1 ms event frequence ? Will the timer event finish in 1 ms ?
If you are inputting data in a form, say, do you want that to be interrupted a 1000 times/sec ?
Gregory