supertime

1.0.0 • Public • Published

Supertime

Build Status

High precision timer module for node.js. It calculates a timespan in nanosecond precision.

const supertime = require('supertime')
 
// start a timer
const timer = supertime.start()
 
// do some fancy stuff
const sum = 1 + 1
if (sum === 2) {
  result = 'yeah!'
}
 
const duration = timer.stop()
 
console.log(`My high complex calculation took ${duration}`)

The supertime.start() method returns a Supertime object which represents the timer. To stop a timer, call timer.stop(). It returns a duration object, which contains the timespan in nanoseconds and returns the timespan as readable string if it gets converted into a string.

const supertime = require('supertime')
 
// start a timer
const timer = supertime.start()
 
// do some fancy stuff
 
const duration = timer.stop()
 
console.log(duration.time) // logs the timespan in nanoseconds
console.log(duration) // logs the timespan as a readable string

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i supertime

    Weekly Downloads

    3

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • andifeind