Skip to content

Commit

Permalink
Node 0.11+ has different timer semantics. Fixes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
STRML committed Feb 25, 2016
1 parent 0850e16 commit c61b044
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ var should = require('should');
var toobusy = require('./');

function tightWork(duration) {
var start = new Date();
while ((new Date() - start) < duration) {
var start = Date.now();
while ((Date.now() - start) < duration) {
for (var i = 0; i < 1e5;) i++;
}
}
Expand Down Expand Up @@ -128,7 +128,7 @@ describe('smoothingFactor', function() {
}
cycles_to_toobusy++;
tightWork(100); // in 3 ticks, will overshoot by ~50ms, above 2*10ms
setTimeout(load, 0);
setImmediate(load);
}

load();
Expand All @@ -144,7 +144,7 @@ describe('smoothingFactor', function() {
}
cycles_to_toobusy++;
tightWork(100);
setTimeout(load, 0);
setImmediate(load);
}

load();
Expand Down

0 comments on commit c61b044

Please sign in to comment.