Skip to content

Instantly share code, notes, and snippets.

@jokemmy
Last active August 28, 2017 15:11
Show Gist options
  • Save jokemmy/cbb0d3dc5e5d65efe50b722a0956322c to your computer and use it in GitHub Desktop.
Save jokemmy/cbb0d3dc5e5d65efe50b722a0956322c to your computer and use it in GitHub Desktop.
performance.now() vs Date.now()

Date.now()

returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC

performance.now()

returns the number of milliseconds/microseconds elapsed since an arbitrary epoch

Basically, performance.now() should only be used when you want to measure the relative distance between two time points, not their "absolute" position in time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment