# @sapphire/stopwatch

> Accurately measure passing time.

Latest version **1.5.4** (published 2024-11-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @sapphire/stopwatch
pnpm add @sapphire/stopwatch
yarn add @sapphire/stopwatch
bun add @sapphire/stopwatch
```

## Health

**Score 55/100 (C)** — status: stable.

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

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.5.4 |
| Published | 2024-11-09 |
| First published | 2020-12-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=v14.0.0 |
| Dependencies | 1 |
| Unpacked size | 42.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 191 |
| Author | @sapphire |
| Maintainers | favna, vladfrangu, kyranet |
| Keywords | @sapphire/stopwatch, bot, typescript, ts, yarn, discord, sapphire, standalone |

## Links

- npm: https://www.npmjs.com/package/@sapphire/stopwatch
- Repository: https://github.com/sapphiredev/utilities
- Homepage: https://github.com/sapphiredev/utilities/tree/main/packages/stopwatch
- Issues: https://github.com/sapphiredev/utilities/issues
- npm.io page: https://npm.io/package/@sapphire/stopwatch

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.8.1

## Alternatives

- [csv-to-markdown-table](https://npm.io/package/csv-to-markdown-table.md) — 47.0K weekly downloads
- [@sapphire/ratelimits](https://npm.io/package/@sapphire/ratelimits.md) — 4.4K weekly downloads
- [js-csvparser](https://npm.io/package/js-csvparser.md) — 2.0K weekly downloads
- [@adadapted/js-sdk](https://npm.io/package/@adadapted/js-sdk.md) — 251 weekly downloads
- [@grapecity/spread-sheets-sparklines](https://npm.io/package/@grapecity/spread-sheets-sparklines.md) — 103 weekly downloads

## Recent versions

- 1.5.4 (latest) — 2024-11-09
- 1.5.5-next.c1299bac (next) — 2026-03-08
- 1.6.0-pr-935.7da5c8bb (pr-935) — 2025-11-25
- 1.5.3-pr-725.55b1ff7b.0 (pr-725) — 2024-03-17
- 1.5.2-pr-684.9d7e2fce.0 (pr-684) — 2023-12-14
- 1.6.0-pr-601.2f2c308a.0 (pr-601) — 2023-05-28
- 1.6.0-pr-589.aa473f9.0 (pr-589) — 2023-05-04
- 1.6.0-pr-587.e9607661.0 (pr-587) — 2023-05-04
- 1.6.0-pr-584.b444d5b.0 (pr-584) — 2023-05-02
- 1.5.1-pr-575.91d23d87.0 (pr-575) — 2023-04-16
- 1.5.1-pr-567.8638d898.0 (pr-567) — 2023-04-06
- 1.5.1-pr-434.77ef153.0 (pr-434) — 2023-01-06
- 1.3.0-pr-270.b2c4518.0 (pr-270) — 2022-01-26
- 1.2.0-pr-160.676f855.0 (pr-160) — 2021-08-23
- 1.2.0-pr-159.fae7a606.0 (pr-159) — 2021-08-23
- … 962 more at https://npm.io/package/@sapphire/stopwatch/versions

## README

<div align="center">

![Sapphire Logo](https://raw.githubusercontent.com/sapphiredev/assets/main/banners/SapphireCommunity.png)

# @sapphire/stopwatch

**Accurately measure passing time**

[![GitHub](https://img.shields.io/github/license/sapphiredev/utilities)](https://github.com/sapphiredev/utilities/blob/main/LICENSE.md)
[![npm bundle size](https://img.shields.io/bundlephobia/min/@sapphire/stopwatch?logo=webpack&style=flat-square)](https://bundlephobia.com/result?p=@sapphire/stopwatch)
[![npm](https://img.shields.io/npm/v/@sapphire/stopwatch?color=crimson&logo=npm&style=flat-square)](https://www.npmjs.com/package/@sapphire/stopwatch)

</div>

**Table of Contents**

-   [Description](#description)
-   [Features](#features)
-   [Installation](#installation)
-   [Usage](#usage)
    -   [Basic Usage](#basic-usage)
-   [Buy us some doughnuts](#buy-us-some-doughnuts)
-   [Contributors](#contributors)

## Description

Provides a set of methods and properties that you can use to accurately measure elapsed time.

## Features

-   Written in TypeScript
-   Offers CommonJS, ESM and UMD bundles
-   Fully tested

## Installation

You can use the following command to install this package, or replace `npm install` with your package manager of choice.

```sh
npm install @sapphire/stopwatch
```

## Usage

**Note:** While this section uses `require`, the imports match 1:1 with ESM imports. For example `const { Stopwatch } = require('@sapphire/stopwatch')` equals `import { Stopwatch } from '@sapphire/stopwatch'`.

### Basic Usage

```typescript
// Import the Stopwatch class
const { Stopwatch } = require('@sapphire/stopwatch');

// Create a new Stopwatch (which also starts it immediately)
const stopwatch = new Stopwatch();

// run other task here

console.log(stopwatch.stop().toString());
// 200ms
```

---

## Buy us some doughnuts

Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!

We accept donations through Open Collective, Ko-fi, PayPal, Patreon and GitHub Sponsorships. You can use the buttons below to donate through your method of choice.

|   Donate With   |                       Address                       |
| :-------------: | :-------------------------------------------------: |
| Open Collective | [Click Here](https://sapphirejs.dev/opencollective) |
|      Ko-fi      |      [Click Here](https://sapphirejs.dev/kofi)      |
|     Patreon     |    [Click Here](https://sapphirejs.dev/patreon)     |
|     PayPal      |     [Click Here](https://sapphirejs.dev/paypal)     |

## Contributors

Please make sure to read the [Contributing Guide][contributing] before making a pull request.

Thank you to all the people who already contributed to Sapphire!

<a href="https://github.com/sapphiredev/utilities/graphs/contributors">
  <img src="https://contrib.rocks/image?repo=sapphiredev/utilities" />
</a>

[contributing]: https://github.com/sapphiredev/.github/blob/main/.github/CONTRIBUTING.md

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