本文介绍了毫秒不同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Javascript/jQuery开发秒表应用程序.问题是毫秒值与REAL毫秒不同步.我正在以1 millisecond的间隔使用函数setInterval(),仍然会导致此问题.
I am developing a stopwatch application using Javascript/jQuery. The problem is that the milliseconds value is out of sync with REAL milliseconds. I am using function setInterval() with the interval of 1 millisecond, still it is causing this problem.
jsFiddle: jsfiddle/FLv3s/
jsFiddle: jsfiddle/FLv3s/
请帮助!
推荐答案使用setInterval触发更新,但使用系统时间(通过new Date())进行实际时间计算.
Use setInterval to trigger updates, but use the system time (via new Date()) for the actual time calculations.
更多推荐
毫秒不同步
发布评论