2022-07-11 16:26:17 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
const { Worker } = require('worker_threads');
|
|
|
|
|
|
|
|
const w = new Worker(`
|
|
|
|
require('worker_threads').parentPort.postMessage(performance.timeOrigin);
|
|
|
|
`, { eval: true });
|
|
|
|
|
|
|
|
w.on('message', common.mustCall((timeOrigin) => {
|
2023-02-09 17:00:32 +00:00
|
|
|
// PerformanceNodeTiming exposes process milestones so the
|
|
|
|
// `performance.timeOrigin` in the `worker_threads.Worker` must be the start
|
|
|
|
// time of the process.
|
|
|
|
assert.strictEqual(timeOrigin, performance.timeOrigin);
|
2022-07-11 16:26:17 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
w.on('exit', common.mustCall((code) => {
|
|
|
|
assert.strictEqual(code, 0);
|
|
|
|
}));
|