elapsed-time

nanosecond resolution `stopwatch` for node.js

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
elapsed-time
510.0.19 years ago9 years agoMinified + gzip package size for elapsed-time in KB

Readme

elapsed-time
build status Coverage Status Dependency status
NPM js-standard-style

Installation

npm install elapsed-time

Examples

var ElapsedTime = require('elapsed-time')
var et = ElapsedTime.new().start()
setTimeout(function () {
  console.log(et.getValue()) // should print ~ 10ms
}, 10)

API

static
* [new](#new)
* [setDefaultFormatter](#setdefaultformatter)
methods
* [constructor](#constructor)
* [start](#start)
* [pause](#pause)
* [resume](#resume)
* [sleep](#sleep)
* [reset](#reset)
* [getRawValue](#getrawvalue)
* [getValue](#getvalue)

new

you can use static new instead new keyword
return: ElapsedTime

setDefaultFormatter

function formatter

constructor

Object opts
* `function` [opts.formatter]

start

return: ElapsedTime

pause

return: ElapsedTime

sleep

number timeout
return: ElapsedTime

reset

return: ElapsedTime

getRawValue

return: number

getValue

Object opts
* `function` [opts.formatter]
return: number

License

Code released under the MIT license.