Path: utzoo!utgpu!attcan!uunet!yale!spolsky-joel From: spolsky-joel@CS.YALE.EDU (Joel Spolsky) Newsgroups: comp.sys.ibm.pc Subject: Re: Turbo Pascal 5.0 and GetTime Message-ID: <45794@yale-celray.yale.UUCP> Date: 16 Dec 88 01:27:14 GMT References: <45782@yale-celray.yale.UUCP> Sender: root@yale.UUCP Reply-To: spolsky-joel@CS.YALE.EDU (Joel Spolsky) Organization: Yale University Computer Science Dept, New Haven CT 06520-2158 Lines: 28 In article <45782@yale-celray.yale.UUCP> chen-holly@CS.Yale.EDU (Holly Chen) writes: >I'm running a psychology experiment in which I time people's responses. I >used SetTime and GetTime in Turbo Pascal 5.0 to time the subjects. Although >the manual suggests that the timing is good to the hundredth of a second, it >appears that the timing is not this accurate. The system does not appear to >increment the hundredths of a second at even intervals. Can anybody explain >to me why the system clock seems to time inaccurately? Does anybody know a >good way to time people with this kind of accuracy? Holly, The PC's clock is only updated 18 times per second, so the "time" that the system gives you is only accurate to +/- 55 milliseconds. There are two ways to get finer resolution: 1. Buy a timer card ("official" solution) 2. Write convoluted code that relies on the fact that a certain loop takes x milliseconds to execute, then cheat the compiler, somehow, into not optimizing out the loop (awful "hackers" solution that is guaranteed to break, severely, when you change compilers, DOS versions, hardware, or heck probably even the contrast on the monitor). +----------------+----------------------------------------------------------+ | Joel Spolsky | bitnet: spolsky@yalecs.bitnet uucp: ...!yale!spolsky | | | internet: spolsky@cs.yale.edu voicenet: 203-436-1483 | +----------------+----------------------------------------------------------+ #include