Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Performance 将毫秒转换为小时_Performance_Milliseconds - Fatal编程技术网

Performance 将毫秒转换为小时

Performance 将毫秒转换为小时,performance,milliseconds,Performance,Milliseconds,我正在编写一个超速应用程序,跟踪用户移动时的速度,我设法让速度正常工作(距离/时间),但问题是我不知道使用正确的数字,现在我收到两个不同的时间,并从用户移动时的结束时间中减去起始时间,我只需要算出数学,这样就可以正确地计算公里/小时 现在我把时间除以100,但我很确定这是错误的 speed = distance / ((endTime - initialTime) / 100 ); //work out speed speed = Math.round(speed); //roun

我正在编写一个超速应用程序,跟踪用户移动时的速度,我设法让速度正常工作(距离/时间),但问题是我不知道使用正确的数字,现在我收到两个不同的时间,并从用户移动时的结束时间中减去起始时间,我只需要算出数学,这样就可以正确地计算公里/小时

现在我把时间除以100,但我很确定这是错误的

  speed = distance / ((endTime - initialTime) / 100 ); //work out speed
     speed = Math.round(speed); //round speed to whole number
  KMHtml.innerHTML = speed; //change html span item

谷歌搜索它给了我一个3.6e+6的答案,你应该使用jQuery。为什么@BrendanCannellWell,1秒有1000毫秒,1分钟有60秒,1小时有60分钟,所以。。。毫秒/1000/60/60应该给出小时数。