https://github.com/ianwalter/timer
A high resolution timer that returns the duration in a format thats easy for humans to understand
https://github.com/ianwalter/timer
duration high-resolution timer
Last synced: about 1 year ago
JSON representation
A high resolution timer that returns the duration in a format thats easy for humans to understand
- Host: GitHub
- URL: https://github.com/ianwalter/timer
- Owner: ianwalter
- License: other
- Created: 2019-07-26T00:27:19.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-09-29T19:57:01.000Z (over 2 years ago)
- Last Synced: 2025-04-21T08:44:36.641Z (about 1 year ago)
- Topics: duration, high-resolution, timer
- Language: JavaScript
- Size: 306 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @ianwalter/timer
> A high resolution timer that returns the duration in a format thats easy for
> humans to understand
[![npm page][npmImage]][npmUrl]
## Installation
```console
yarn add @ianwalter/timer
```
## Usage
```js
const createTimer = require('@ianwalter/timer')
const timer = createTimer()
// Call stop() or duration() or both.
const milliseconds = timer.stop()
const duration = timer.duration()
// timer.time => [2, 506289527]
// milliseconds => 2506.29
// duration => 2s 506.29ms
```
## License
Apache 2.0 with Commons Clause - See [LICENSE][licenseUrl]
Created by [Ian Walter](https://iankwalter.com)
[npmImage]: https://img.shields.io/npm/v/@ianwalter/timer.svg
[npmUrl]: https://www.npmjs.com/package/@ianwalter/timer
[licenseUrl]: https://github.com/ianwalter/timer/blob/master/LICENSE