catbee
Version:
Catbee - skeleton for you isomorphic applications
26 lines (23 loc) • 664 B
JavaScript
module.exports = {
/**
* Gets the high resolution time or the difference between
* previous and current time.
* @param {Array?} Previous high resolution timestamp.
* @returns {Array} The high resolution time.
*/
get: process.hrtime,
/**
* Converts the high resolution timestamp to text message.
* @param {Array}
* @returns {string} Time message.
*/
toMessage: require('pretty-hrtime'),
/**
* Converts high resolution time to milliseconds number.
* @param {Array} hrTime High resolution time tuple.
* @return {Number}
*/
toMilliseconds (hrTime) {
return hrTime[0] * 1e3 + Math.round(hrTime[1] / 1e6);
}
};