JSPM

  • Created
  • Published
  • Downloads 16732
  • Score
    100M100P100Q134373F
  • License MIT

thin wrapper around process.hrtime

Package Exports

  • hirestime

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hirestime) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

hirestime Build Status

NPM

NPM

hirestime is a thin wrapper around process.hrtime() that does the clumsy handling of the returned array for you.

Installation

npm install hirestime

hirestime()

returns a function:

returnedFunction([unit])

returns the elapsed time since the call of hirestime in milliseconds.
an optional unit parameter can be specified that will cause an recalculation.
possible parameters

  • hirestime.S elapsed time in seconds
  • hirestime.MS elapsed time in milliseoncds
  • hirestime.NS elapsed time in nanoseconds

Examples

var hirestime = require('../');

//startpoint of the time measurement
var getElapsed = hirestime();

setTimeout(function() {
    //returns the elapsed milliseconds
    console.log(getElapsed());
}, 1000);
var hirestime = require('../');

//startpoint of the time measurement
var getElapsed = hirestime();

setTimeout(function() {
   //returns the elapsed seconds
   console.log(getElapsed(hirestime.S));
}, 1000);