Is there any way to get current time in nanoseconds using JavaScript?

Carlos Melo picture Carlos Melo · May 14, 2011 · Viewed 47.8k times · Source

So, I know I can get current time in milliseconds using JavaScript. But, is it possible to get the current time in nanoseconds instead?

Answer

Jeffrey Yasskin picture Jeffrey Yasskin · Aug 9, 2012

Achieve microsecond accuracy in most browsers using:

window.performance.now()

See also: