Modern high-resolution timing helpers for JavaScript and TypeScript.
w3c-hr-time is deprecated because current platforms expose performance.now() and performance.timeOrigin natively. This package keeps the small compatibility surface that old code used while delegating to native timing APIs.
npm install hr-time-modernimport { Performance, getGlobalMonotonicClockMS } from "hr-time-modern";
const performance = new Performance();
setTimeout(() => {
console.log(performance.now());
}, 100);
console.log(getGlobalMonotonicClockMS());Creates an isolated timer with:
timeOrigin: high-resolution Unix timestamp for construction time.now(): milliseconds elapsed since construction.toJSON():{ timeOrigin }.
Returns a monotonically increasing millisecond timestamp.
Always true on supported runtimes.
The platform performance object used internally.
hr-time-modern is an independent alternative or migration helper for projects moving away from w3c-hr-time. It is not affiliated with the original package maintainers or project.
For release context, see the local migration guide, examples, compatibility notes, source metadata, and adoption plan.