GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: use libuv clock for immediate queue test · nodejs/node@cf7680e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-timers-immediate-queue.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-timers-immediate-queue.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-timers-immediate-queue.js
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@
1919
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

22+
// Flags: --expose-internals --no-warnings
23+
2224
'use strict';
2325
require('../common');
2426
const assert = require('assert');
27+
const { internalBinding } = require('internal/test/binding');
28+
const timersBinding = internalBinding('timers');
2529

2630
// setImmediate should run clear its queued cbs once per event loop turn
2731
// but immediates queued while processing the current queue should happen
@@ -38,8 +42,8 @@ const QUEUE = 10;
3842
function run() {
3943
if (hit === 0) {
4044
setTimeout(() => { ticked = true; }, 1);
41-
const now = Date.now();
42-
while (Date.now() - now < 2);
45+
const now = timersBinding.getLibuvNow();
46+
while (timersBinding.getLibuvNow() - now < 2);
4347
}
4448

4549
if (ticked) return;

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.