A question of timing

I've written an app in Javascript which measures a user's response time (in milliseconds) to a stimulus*. I suspect that there's a discrepancy between the recorded time and the actual time due to the process scheduler/queue.

I'd like a meta-timer, but that would exacerbate the situation. I figure that there's no way to prevent deviation, but maybe the deviation can be normalised. How to do this, however, is beyond me.

I'd be grateful for any input on this problem


*Edit: The response fires the onkeypress event.
 
You will never get a millisecond timer in javascript I'm afraid.
Normalising the deviation would be impossible also as at any given time the loads will be quite different and you can't get an accurate heartbeat with which to synchronise your delay. Especially in a keypress event which will fire on the UI thread which is a different thread to your timer.

You could look into something like the Reactive framework? Not overly familiar with it but it deals with queueing events so they might have more accurate timings..
 
EVENT GUIDE - HIGHLIGHT
The Complete Stone Roses
The Oliver Plunkett, Oliver Plunkett St.

1st Aug 2024 @ 8:00 pm
More info..

Cork Roots Festival : Susan O' Neill

Coughlan's, Tomorrow @ 7:30pm

More events ▼
Top