0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-25 08:19:38 +01:00
nodejs/test/parallel/test-timers-first-fire.js

13 lines
340 B
JavaScript
Raw Normal View History

var common = require('../common');
var assert = require('assert');
var TIMEOUT = 50;
var last = process.hrtime();
setTimeout(function() {
var hr = process.hrtime(last);
var ms = (hr[0] * 1e3) + (hr[1] / 1e6);
var delta = ms - TIMEOUT;
console.log('timer fired in', delta);
assert.ok(delta > 0, 'Timer fired early');
}, TIMEOUT);