# node-tictoc

> Simple stopwatch timer for profiling operations

Latest version **1.3.0** (published 2016-07-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-tictoc
pnpm add node-tictoc
yarn add node-tictoc
bun add node-tictoc
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2016-07-14 |
| First published | 2014-03-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Joel Kemp |
| Maintainers | mrjoelkemp |
| Keywords | timer, profiler, elapsed, seconds, milliseconds |

## Links

- npm: https://www.npmjs.com/package/node-tictoc
- Repository: https://github.com/mrjoelkemp/node-tictoc
- Issues: https://github.com/mrjoelkemp/node-tictoc/issues
- npm.io page: https://npm.io/package/node-tictoc

## Recent versions

- 1.3.0 (latest) — 2016-07-14
- 1.2.0 — 2016-01-10
- 1.1.0 — 2014-07-24
- 1.0.0 — 2014-03-28

## README

### tictoc

`npm install node-tictoc`

Wrapper around `process.hrtime` that lets you have a stack of timers with a simpler api and more useful output:

### Usage

```javascript
  var time = require('node-tictoc');

  time.tic();

  for(var i = 0; i < 1000; i++) {
    // do something
  }

  time.toc(); // prints the elapsed seconds and/or milliseconds
```

Or a recursive timing solution that takes advantage of the stack:

```javascript
  function foo(n) {
    if (! n) return;

    time.tic();

    foo(n - 1);

    time.toc(); // prints the elapsed time in last-in-first-out (LIFO) order
  }
```

If you just want the time values:

```javascript
  time.toct()
```

If you want the profiling string but don't want it console logged automatically:

```
  time.stoc();
```

Returns an object with the following values for the most recent timer (started with `tic`):

* `seconds`
* `nanos`
* `ms`

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