/
githubmirror
/
styled-components
Обзор
Документация
Войти
/
githubmirror
/
styled-components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/benchmarks/src/app/Benchmark/timing.js
16 строк
461 B
Evan Jacobs
benchmarks
06 май 2021, 02:51
06 май 2021, 02:51
2fb0862
Код
Авторство
О чём код?
const NS_PER_MS = 1e6; const MS_PER_S = 1e3; // Returns a high resolution time (if possible) in milliseconds export function now() { if (window && window.performance) { return window.performance.now(); } else if (process && process.hrtime) { const [seconds, nanoseconds] = process.hrtime(); const secInMS = seconds * MS_PER_S; const nSecInMS = nanoseconds / NS_PER_MS; return secInMS + nSecInMS; } else { return Date.now(); } }