I am developing an application using Processing.js.
At each step of the drawing cycle, I increase the number of frames by one frame++.
I want to know how much time has passed. Currently, to get the time (knowing that my application is configured to run on 60FPS), I like to: time=frame/60. But this only works if the application always works exactly with FPS, and we all know that this is not so, because it depends on the user's equipment.
I want the timer to be pretty accurate (only with error 0.0001s).
It is also recommended that you welcome some javascript algorithm to calculate the difference between now () and start_time ().
source
share