Path: utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!bu.edu!att!oucsace!oucsace.cs.ohiou.edu From: tswingle@oucsace.cs.ohiou.edu (Tom Swingle) Newsgroups: comp.lang.pascal Subject: Timing in Turbo Pascal Message-ID: <2280@oucsace.cs.OHIOU.EDU> Date: 27 Oct 90 17:10:35 GMT Sender: tswingle@oucsace.cs.OHIOU.EDU Distribution: na Organization: Ohio University CS Dept., Athens Lines: 28 Does anybody know of a way to *accurately* time an event down to at least 1/100 of a second in Turbo Pascal? I have tried using the GetTime procedure, but it relies on DOS, which is only accurate to about 5/100 of a second. Turbo Pascal has the Delay procedure which can accurately time to 1/1000 of a second. Does anybody know how they do this? Here is what I would like to do. I would like to create a little unit called Timer which would have procedures for timing how long a block takes to execute regardless of the speed of the machine it is working on. It would work something like this: uses Timer; var t:word; begin MarkTime; { Start counting now } . . . . . . . t:=TimeElapsed; { Check how much time elapsed in 1/100 seconds } end. This way, you could make a block take the same amount of time to execute on any machine, regardless of that machine's speed by just looping until TimeElapsed had reached the time you wanted it to. But I found that it has to be accurate to at least 1/100 of a second to be useful. If anyone can help me it would be greatly appreciated. (Either E-mail or a follow-up post is fine)