0

TLDR: Is there data on variation of JS's Date accuracy?

I'm looking into doing some research online, gathering reaction data for experiments.

As a contrived example, let's say a user clicks a button and a new image is displayed on the screen. For the purposes of the question imagine that this takes somewhere between 50 and 100ms I need to measure the delay between an interaction (e.g. a button click) and the displaying of the new DOM state, ideally to millisecond accuracy.

I've looked into it (including through SO with questions like this) and so far it doesn't really seem like using JS's built-in Dates will really cut it, since a delay in the execution thread can push the time out of sync. This seems a bit odd to me as dates are measured to ms precision, and yet accuracy seems to be much larger.

I'm also aware that there are other latencies associated, such as screen refresh rate. This question is purely about the execution inaccuracies.

My question is this: Is there any data on the error rates/variations etc. of the Date object across browsers/operating systems? Although it would be good to get an idea of the overall variation across systems what I'm really after is the repeat trial variation (doing the same thing on the same system over and over).

I'm looking for a solution that can be delivered entirely using a client-side browser, so no extensions or other executables that a user would need to download.

Tom
  • 1,158
  • 6
  • 19
  • 1
    Not an answer to your specific question, I know, but these days the client-side method for timing is the Performance API (see: https://developer.mozilla.org/en-US/docs/Web/API/Performance_API), not Date. – Mr Incredible Mar 28 '22 at 16:46
  • Thanks for the pointer. Looks like this has the same issues (arguably more so) than creating Date timestamps as 1/1000th ms would be way more precise than accurate – Tom Mar 29 '22 at 08:54

0 Answers0