time-to-botec/js/node_modules/@stdlib/time/toc
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00
..
docs feat: add the node modules 2022-12-03 12:44:49 +00:00
lib feat: add the node modules 2022-12-03 12:44:49 +00:00
package.json feat: add the node modules 2022-12-03 12:44:49 +00:00
README.md feat: add the node modules 2022-12-03 12:44:49 +00:00

toc

Return a high-resolution time difference.

Usage

var toc = require( '@stdlib/time/toc' );

toc( time )

Returns a high-resolution time difference, where time is a two-element array with format [seconds, nanoseconds].

var delta = toc( [ 100, 123456789 ] );
// returns [<number>,<number>]

Similar to time, the returned array has format [seconds, nanoseconds].

Notes

  • This function is intended to be used in conjunction with tic for measuring performance between intervals.

Examples

var tic = require( '@stdlib/time/tic' );
var toc = require( '@stdlib/time/toc' );

var start = tic();

setTimeout( onTimeout, 2000 );

function onTimeout() {
    var elapsed = toc( start );
    console.log( 'Elapsed: %d seconds and %d nanoseconds', elapsed[0], elapsed[1] );
}