Skip to content

Instantly share code, notes, and snippets.

@misterdjules
Created December 10, 2014 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save misterdjules/be83fceb59753bf4b8f7 to your computer and use it in GitHub Desktop.
Save misterdjules/be83fceb59753bf4b8f7 to your computer and use it in GitHub Desktop.
diff --git a/test/simple/test-timers-unref-active.js b/test/simple/test-timers-unref-active.js
index 851ef1c..ce07c2d 100644
--- a/test/simple/test-timers-unref-active.js
+++ b/test/simple/test-timers-unref-active.js
@@ -40,7 +40,16 @@ var assert = require('assert');
var someObject = {};
var nbTimeouts = 0;
-var N = 10;
+/*
+ * libuv 0.10.x uses GetTickCount on Windows to implement timers, which uses
+ * system's timers whose resolution is between 10 and 16ms. See
+ * http://msdn.microsoft.com/en-us/library/windows/desktop/ms724408.aspx
+ * for more information. That's the lowest resolution for timers across all
+ * supported platforms. We're using it as the lowest common denominator,
+ * and thus expect 5 timers to be able to fire in under 100 ms.
+ */
+var N = 5;
+var TEST_DURATION = 100;
timers.unenroll(someObject);
timers.enroll(someObject, 1);
@@ -59,4 +68,4 @@ startTimer();
setTimeout(function() {
assert.equal(nbTimeouts, N);
-}, 100);
+}, TEST_DURATION);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment