[comp.sys.mac.programmer] millisec timing

sekuler@psych.toronto.edu (Allison Sekuler) (03/14/91)

I'm writing a program (Think C) in which I need to record
response times to the nearest millisecond (or thereabouts)
from the onset of an event until the mouseButton is pressed.
Does anyone know how this can be done?


Thanks in advance for any and all help,

Allison Sekuler
Dept of Psychology
U of Toronto
sekuler@psych.utoronto.ca

6500rgls@ucsbuxa.ucsb.edu (Randall S Geels) (03/14/91)

In order to achieve millisecond resolution on the mac you either need
to grab one of the VIA's timers and use that, or use the Time Manager
and set an interrupt to happen periodically (in this case every 1 ms)
If your application will run under multifinder then you need to watch
out for other things which might also use the VIA's timers (eg. sound
and disk accesses). In any case this can be somewhat tricky to do.
Hope this helps a little. :)

--Randy Geels

mk2s+@andrew.cmu.edu (Michael-Makihiko John Kato) (03/15/91)

Millisecond timing is possible, but don't forget ADB only gets polled
every (11 or 14)ms.  I can't remember the actual numbers but it is a lot
more than a millisecond.  In implementing Mac MEL (from PST) we
basically had the same problem.  If you really need accuracy then you
should read from a response box hangging off the serial port or the SCSI
port.  I hope this helps.



....maki....
mk2s@andrew.cmu.edu