毫秒不同步 [英] Milliseconds out of sync
本文介绍了毫秒不同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用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: http://jsfiddle.net/FLv3s/
jsFiddle: http://jsfiddle.net/FLv3s/
请帮助!
推荐答案
使用setInterval
触发更新,但使用系统时间(通过new Date()
)进行实际时间计算.
Use setInterval
to trigger updates, but use the system time (via new Date()
) for the actual time calculations.
这篇关于毫秒不同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文