summaryrefslogtreecommitdiff
path: root/test/parallel/test-timers-ordering.js
diff options
context:
space:
mode:
authorAnatoli Papirovski <apapirovski@mac.com>2018-05-13 17:42:22 +0200
committerAnatoli Papirovski <apapirovski@mac.com>2018-06-24 21:35:05 -0700
commit2930bd1317d15d12738a4896c0a6c05700411b47 (patch)
tree5c9225b9740c79d83ea2ded69d63b94a66846036 /test/parallel/test-timers-ordering.js
parent6f63f8d730c8c3b19de7a591c35d376d428a4d56 (diff)
downloadandroid-node-v8-2930bd1317d15d12738a4896c0a6c05700411b47.tar.gz
android-node-v8-2930bd1317d15d12738a4896c0a6c05700411b47.tar.bz2
android-node-v8-2930bd1317d15d12738a4896c0a6c05700411b47.zip
src: refactor timers to remove TimerWrap
Refactor Timers to behave more similarly to Immediates by having a single uv_timer_t handle which is stored on the Environment. No longer expose timers in a public binding and instead make it part of the internalBinding. PR-URL: https://github.com/nodejs/node/pull/20894 Fixes: https://github.com/nodejs/node/issues/10154 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'test/parallel/test-timers-ordering.js')
-rw-r--r--test/parallel/test-timers-ordering.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/parallel/test-timers-ordering.js b/test/parallel/test-timers-ordering.js
index 06346c6b2f..d9629e0319 100644
--- a/test/parallel/test-timers-ordering.js
+++ b/test/parallel/test-timers-ordering.js
@@ -19,11 +19,13 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
+// Flags: --expose-internals
+
'use strict';
require('../common');
const assert = require('assert');
+const { getLibuvNow } = require('internal/timers');
-const Timer = process.binding('timer_wrap').Timer;
const N = 30;
let last_i = 0;
@@ -36,8 +38,7 @@ function f(i) {
last_i = i;
// check that this iteration is fired at least 1ms later than the previous
- const now = Timer.now();
- console.log(i, now);
+ const now = getLibuvNow();
assert(now >= last_ts + 1,
`current ts ${now} < prev ts ${last_ts} + 1`);
last_ts = now;
@@ -46,4 +47,4 @@ function f(i) {
setTimeout(f, 1, i + 1);
}
}
-f(1);
+setTimeout(f, 1, 1);