Measuring players reaction in milliseconds

Hello,

I’m measuring players reaction between two touches and I’d like to know if games FPS may skew the results. I’m using RuntimeEventListener. I need to count the reaction in a unit smaller than seconds therefore I’m not using os.time() because it shows time in seconds.

My app is setup to have 60FPS. In theory I should count reaction 60 times per second.

reaction = 0 -- at the beginning of the game level local function countReaction() reaction = reaction + 1 end Runtime:addEventListener( "enterFrame", countReaction ) -- here follows code to store reaction value in the table and reset counter back to 0

Now if somebody’s device is slower and has lower FPS I expect that counter does not measure correctly anymore. My goal is to measure time in milliseconds between 2 touches on the screen. Is there any other way of measuring time accurately?

You should use system.getTimer

The enterFrame event should include the time (similar to system.getTimer) … see or  http://docs.coronalabs.com/api/event/enterFrame/time.html

(you’ll need your countReaction function to catch the event argument)

You should use system.getTimer

The enterFrame event should include the time (similar to system.getTimer) … see or  http://docs.coronalabs.com/api/event/enterFrame/time.html

(you’ll need your countReaction function to catch the event argument)