I\'m writing an HTML5 Game Development Javascript framework and I want to provide the user the difference in time between the last tick and the current one.
This is what I use:
var lastTick = performance.now() function tick(nowish) { var delta = nowish - lastTick lastTick = nowish update(delta) render(delta) window.requestAnimationFrame(lastTick) } window.requestAnimationFrame(lastTick)