# @ljharb/now

> The current time in milliseconds, from the most precise monotonic clock available (`performance.now` → `process.hrtime` → `Date.now` → `new Date().getTime()`), for measuring elapsed time.

Latest version **1.0.1** (published 2026-06-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ljharb/now
pnpm add @ljharb/now
yarn add @ljharb/now
bun add @ljharb/now
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2026-06-09 |
| First published | 2026-06-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 0.4 |
| Dependencies | 3 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jordan Harband |
| Maintainers | ljharb |
| Keywords | now, time, timestamp, monotonic, clock, high-resolution, hrtime, performance.now, elapsed, duration |

## Links

- npm: https://www.npmjs.com/package/@ljharb/now
- Repository: https://github.com/ljharb/now
- Homepage: https://github.com/ljharb/now#readme
- Issues: https://github.com/ljharb/now/issues
- Funding: https://github.com/sponsors/ljharb
- npm.io page: https://npm.io/package/@ljharb/now

## Dependencies (3)

- [call-bound](https://npm.io/package/call-bound.md) ^1.0.4
- [get-intrinsic](https://npm.io/package/get-intrinsic.md) ^1.3.0
- [call-bind-apply-helpers](https://npm.io/package/call-bind-apply-helpers.md) ^1.0.2

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2026-06-09
- 1.0.0 — 2026-06-08

## README

# @ljharb/now <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

[![npm badge][npm-badge-png]][package-url]

The current time, in milliseconds, from the most precise monotonic clock available - `performance.now()`, then `process.hrtime()`, then `Date.now()`, then `new Date().getTime()` (for ES3). Works in browsers and node, all the way back to ES3.

The returned value has an arbitrary origin and is only meaningful relative to another call:
subtract two readings to get an elapsed duration, in milliseconds.
Where the platform provides a monotonic clock (the first two tiers),
it is unaffected by system clock changes.

## Usage / Example

```javascript
var now = require('@ljharb/now');
var assert = require('assert');

assert.equal(typeof now(), 'number');

var start = now();
// ... do some work ...
var elapsed = now() - start;

assert.equal(typeof elapsed, 'number');
assert.ok(elapsed >= 0);
```

[package-url]: https://npmjs.org/package/@ljharb/now
[npm-version-svg]: https://versionbadg.es/ljharb/now.svg
[npm-badge-png]: https://nodei.co/npm/@ljharb/now.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/@ljharb/now.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/@ljharb/now.svg
[downloads-url]: https://npm-stat.com/charts.html?package=@ljharb/now
[codecov-image]: https://codecov.io/gh/ljharb/now/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/ljharb/now/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/now
[actions-url]: https://github.com/ljharb/now/actions

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