Precision timer for nanosecond differences
npm install precisejavascript
import {precise} from "precise";
const timer = precise().start();
setTimeout(() => console.log(timer.stop().diff()), 1000);
`
Using the Class
`javascript
import {Precise} from "precise";
const timer = new Precise().start();
setTimeout(() => console.log(timer.stop().diff()), 1000);
`
`javascript
import {Precise} from "precise";
class MyTimer extends Precise {}
`
Testing
Precise has 100% code coverage with its tests.
`console
-------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------|---------|----------|---------|---------|-------------------
All files | 100 | 100 | 100 | 100 |
precise.cjs | 100 | 100 | 100 | 100 |
-------------|---------|----------|---------|---------|-------------------
`
API
$3
Returns the time delta between start() & stop(); setting optional parameter to true` will return the delta as milliseconds