# performance-now

> Implements performance.now (based on process.hrtime).

Latest version **2.1.0** (published 2017-02-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install performance-now
pnpm add performance-now
yarn add performance-now
bun add performance-now
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2017-02-19 |
| First published | 2013-05-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Braveg1rl |
| Maintainers | meryn |

## Links

- npm: https://www.npmjs.com/package/performance-now
- Repository: https://github.com/braveg1rl/performance-now
- Issues: https://github.com/braveg1rl/performance-now/issues
- npm.io page: https://npm.io/package/performance-now

## Recent versions

- 2.1.0 (latest) — 2017-02-19
- 2.0.0 — 2017-01-08
- 1.0.2 — 2017-01-08
- 1.0.1 — 2017-01-03
- 1.0.0 — 2017-01-03
- 0.2.0 — 2014-09-17
- 0.1.4 — 2014-08-25
- 0.1.3 — 2013-08-21
- 0.1.2 — 2013-05-23
- 0.1.1 — 2013-05-22
- 0.1.0 — 2013-05-22

## README

# performance-now [![Build Status](https://travis-ci.org/braveg1rl/performance-now.png?branch=master)](https://travis-ci.org/braveg1rl/performance-now) [![Dependency Status](https://david-dm.org/braveg1rl/performance-now.png)](https://david-dm.org/braveg1rl/performance-now)

Implements a function similar to `performance.now` (based on `process.hrtime`).

Modern browsers have a `window.performance` object with - among others - a `now` method which gives time in milliseconds, but with sub-millisecond precision. This module offers the same function based on the Node.js native `process.hrtime` function.

Using `process.hrtime` means that the reported time will be monotonically increasing, and not subject to clock-drift.

According to the [High Resolution Time specification](http://www.w3.org/TR/hr-time/), the number of milliseconds reported by `performance.now` should be relative to the value of `performance.timing.navigationStart`.

In the current version of the module (2.0) the reported time is relative to the time the current Node process has started (inferred from `process.uptime()`).

Version 1.0 reported a different time. The reported time was relative to the time the module was loaded (i.e. the time it was first `require`d). If you need this functionality, version 1.0 is still available on NPM.

## Example usage

```javascript
var now = require("performance-now")
var start = now()
var end = now()
console.log(start.toFixed(3)) // the number of milliseconds the current node process is running
console.log((start-end).toFixed(3)) // ~ 0.002 on my system
```

Running the now function two times right after each other yields a time difference of a few microseconds. Given this overhead, I think it's best to assume that the precision of intervals computed with this method is not higher than 10 microseconds, if you don't know the exact overhead on your own system.

## License

performance-now is released under the [MIT License](http://opensource.org/licenses/MIT).
Copyright (c) 2017 Braveg1rl

---
_Source: https://npm.io/package/performance-now · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
