vendored Bare bundles and seeder parity; tighten the no-`node:` verifier and host-vs-image docs; expand syscall/proc JSON with POSIX XSH-style ops, errno hints, signals, and schema updates; add simulated FD table hooks, pathconf/getconf coverage, IPC message-queue surface, swarm/protomux pool metrics and HyperDHT stats env; extend systemctl verbs, cron TZ-aware matching, Pear updater and corestore snapshot hints, WASM instantiate behind a gate, and runBin default timeout merging with caller abort options. Bump BARE_OS_CTX_API_VERSION to 1.34.0 and BARE_OS_POSIX_PROFILE_VERSION to 1.0.1; sync declared profile, compliance matrix, handbook, example syscalls JSON, CHANGELOG, and generated ctx client helper; extend bare-os-ctx.d.ts for new ctx members.
43 lines
1011 B
JavaScript
43 lines
1011 B
JavaScript
/**
|
|
* Monotonic timing for spans (performance.now when available; else coarse wall fallback).
|
|
*/
|
|
export function bareOsMonotonicNowMs() {
|
|
if (typeof globalThis.performance?.now === 'function') {
|
|
return globalThis.performance.now()
|
|
}
|
|
return Date.now()
|
|
}
|
|
|
|
/**
|
|
* @param {number} startMs
|
|
*/
|
|
export function bareOsMonotonicElapsedMs(startMs) {
|
|
return Math.max(0, bareOsMonotonicNowMs() - startMs)
|
|
}
|
|
|
|
/**
|
|
* High-resolution time for `/proc` hints: `process.hrtime.bigint` when available, else `performance.now`.
|
|
*/
|
|
export function bareOsHrtimeSnapshot() {
|
|
try {
|
|
const hr = globalThis.process?.hrtime?.bigint
|
|
if (typeof hr === 'function') {
|
|
const ns = hr.call(globalThis.process)
|
|
return {
|
|
schema: 1,
|
|
source: 'process.hrtime.bigint',
|
|
bigintNs: ns.toString(),
|
|
atMs: Date.now()
|
|
}
|
|
}
|
|
} catch {
|
|
/* ignore */
|
|
}
|
|
return {
|
|
schema: 1,
|
|
source: 'performance.now',
|
|
monotonicMs: bareOsMonotonicNowMs(),
|
|
atMs: Date.now()
|
|
}
|
|
}
|