aboutsummaryrefslogtreecommitdiff
path: root/test/sequential/test-timers-set-interval-excludes-callback-duration.js
blob: 736b0f56c5d745d2aa616f91092603264e90cc4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';
const common = require('../common');
const Timer = process.binding('timer_wrap').Timer;
const assert = require('assert');

let cntr = 0;
let first;
const t = setInterval(() => {
  cntr++;
  if (cntr === 1) {
    first = Timer.now();
    common.busyLoop(100);
  } else if (cntr === 2) {
    assert(Timer.now() - first < 120);
    clearInterval(t);
  }
}, 100);