/** * The injectable wall-clock contract: the platform time primitives time-dependent code reads. A consumer holds a `Clock` rather than calling `Date.now()` / * `node:timers/promises` `setTimeout` directly, so a test can substitute a controllable double (`TestClock`) and drive time deterministically while production behavior * stays unchanged through {@link systemClock}. * * @see systemClock * * @category Utilities */ export interface Clock { /** * Resolve after `ms` milliseconds, or reject if `init.signal` aborts first. The production {@link systemClock} implements this as `node:timers/promises` `setTimeout`, * so an abort rejects with that primitive's `AbortError` (`name` `"AbortError"`, `code` `"ABORT_ERR"`) rather than the signal's reason. * * @param ms - The delay, in milliseconds. * @param init - Optional init options. `signal` cancels the delay - resolving the wait early with a rejection - when it aborts. * * @returns A promise that resolves after the delay, or rejects with an `AbortError` if the signal aborts first. */ delay(ms: number, init?: { signal?: AbortSignal; }): Promise; /** * Return the current time as epoch milliseconds. The production {@link systemClock} implements this as `Date.now()`. * * @returns The current time in epoch milliseconds. */ now(): number; } /** * The behavior-neutral production {@link Clock}: `now()` IS `Date.now()` and `delay()` IS `node:timers/promises` `setTimeout`. A consumer that routes its time reads * through this clock instead of calling those primitives directly cannot observe any behavior change - it is the same two calls, one indirection removed at test time. * * @see Clock * * @category Utilities */ export declare const systemClock: Clock; //# sourceMappingURL=clock.d.ts.map