Don’t use the front-end for this. Start a timer with API. Track the time it started, and the time it ended. Have the API respond back with the total time elapsed.

For the front-end part, you just use any timer plugin that can take those parameters and adjust accordingly.

I have built an off-site API system to handle this, I can add you to the waiting list if you like.

This way, your times are all accurate and will always be server-side.