Date.now vs performance.now

Date.now() returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC, performance.now() returns the number of milliseconds, with microseconds in the fractional part, from performance.timing.navigationStart, the start of navigation of the document, to the performance.now() call. Another important difference between Date.now() and performance.now() is that the latter is monotonically increasing, so the difference between two calls will never be negative.

 

Date.now是相对于1970年0:00:00的 

 

performance.now是相对于navigationStart的

 

https://stackoverflow.com/questions/30795525/performance-now-vs-date-now

posted @ 2021-09-06 20:38  hh9515  阅读(99)  评论(0)    收藏  举报