Re: More accurate Timerevent
- From: Dirk Claessens <No@xxxxxxxxxxx>
- Date: Tue, 21 Nov 2006 21:22:37 GMT
On 2006-11-20, Gert Baars (62.194.53.8) wrote in
message <73d6e$4561b3d6$3ec23508$15065@xxxxxxxxxxxxxx>
Hello,
Thank you for info. I'd like to try timeSetEvent but Delphi 7 doesn't
recognize it and helpfunction neither. Do I need to add a .dcu at 'uses'? Is this somehow documented?
Gert,
Don't bother looking for it... it's a waist of time.
You **cannot** generate accurately timed events on a Windows platform. As others said: you need hardware.
Try the following:
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
Buffer: TStringList;
begin
Buffer := TStringList.Create;
for i := 1 to 1000 do
begin
Buffer.Add( IntToStr(GetTickCount) );
Sleep(1);
end;
Memo1.Lines.AddStrings( Buffer);
Buffer.Free;
end;
GetTickCount() has a resolution of 1 ms, so we would expect to see it's value incrementing by 1 ms or there about , right?
On a WinXP system ( which has a system interrupt period of 15ms) , you will observe something like this:
1555474375
1555474375
1555474375
1555474375
1555474375
1555474375
1555474375
1555474375
1555474390
1555474390
1555474390
1555474390
1555474390
1555474390
1555474390
1555474390
1555474406
1555474406
1555474406
1555474406
1555474406
1555474406
1555474406
1555474406
1555474421
1555474421
1555474421
1555474421
1555474421
1555474421
1555474421
1555474421
1555474437
1555474437
1555474437
1555474437
1555474437
....
See what I mean?
--
Dirk.
No trees were killed in the creation of this message;
however, many electrons were terribly inconvenienced.
http://users.pandora.be/dirk.claessens2
.
- Follow-Ups:
- Re: More accurate Timerevent
- From: Peter Ingham
- Re: More accurate Timerevent
- References:
- More accurate Timerevent
- From: Gert Baars
- Re: More accurate Timerevent
- From: Gert Baars
- More accurate Timerevent
- Prev by Date: I've completed a set of tools written by VCL
- Next by Date: Re: More accurate Timerevent
- Previous by thread: Re: More accurate Timerevent
- Next by thread: Re: More accurate Timerevent
- Index(es):