/** * 计算耗时 * timeNumber: 338558(单位:ms) * 返回:00:05:38,558 */ async function calcTime(timeNumber) { var hUnit = 60 * 60 * 1000; var mUnit = 60 * 1000; var sUnit = 1000; var h = Math.trunc(timeNumber / hUnit); var m = Math.trunc((timeNumber % hUnit) / mUnit); var s = Math.trunc(((timeNumber % hUnit) % mUnit) / sUnit); var ms = Math.trunc(((timeNumber % hUnit) % mUnit) % sUnit); var calcResult = `${(Array(2).join(0) + h).slice(-2)}:${(Array(2).join(0) + m).slice(-2)}:${(Array(2).join(0) + s).slice(-2)},${(Array(3).join(0) + ms).slice(-3)}`; return calcResult }