# data-stopwatch

> Measure the elapsed time in your code between two moments

Latest version **0.1.0** (published 2019-02-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install data-stopwatch
pnpm add data-stopwatch
yarn add data-stopwatch
bun add data-stopwatch
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2019-02-26 |
| First published | 2019-02-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Pedro M. Silva |
| Maintainers | pedromsilva |
| Keywords | stopwatch, time, benchmark, clock |

## Links

- npm: https://www.npmjs.com/package/data-stopwatch
- Repository: https://github.com/pedromsilvapt/data-stopwatch
- Homepage: https://github.com/pedromsilvapt/data-stopwatch#readme
- Issues: https://github.com/pedromsilvapt/data-stopwatch/issues
- npm.io page: https://npm.io/package/data-stopwatch

## 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

- 0.1.0 (latest) — 2019-02-26

## README

# data-stopwatch
> Measure the elapsed time in your code between two moments

## Installation
```shell
npm install --save data-stopwatch
```

## Usage
```typescript
const stopwatch = new Stopwatch();

// Code to measure

// Returns a tuple [number, number] that means [seconds, nanoseconds]
stopwatch.pause().read();
// Returns a single number as milliseconds
stopwatch.pause().readMilliseconds();
// Returns a string representing an approximation of the elapsed time readable to humans
stopwatch.pause().readHumanized();

// Any stopwatch can be paused and resumed as many times as needed
stopwatch.resume();

// Also, it might be useful to mark named moments in the stopwatch

stopwatch.mark( 'name1' );

// Also possible to create marks that only count time after a previous mark
stopwatch.mark( 'name2', 'name1' );

// Their times can be read with the same methods as before but with the mark name as argument
stopwatch.readHumanized( 'name2' );
```

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