MCPcopy Create free account
hub / github.com/nodejs/node / setTime

Method setTime

lib/internal/test_runner/mock/mock_timers.js:774–780  ·  view source on GitHub ↗

* Sets the current time to the given epoch. * @param {number} time The epoch to set the current time to.

(time = kInitialEpoch)

Source from the content-addressed store, hash-verified

772 * @param {number} time The epoch to set the current time to.
773 */
774 setTime(time = kInitialEpoch) {
775 validateNumber(time, 'time');
776 this.#assertTimeArg(time);
777 this.#assertTimersAreEnabled();
778
779 this.#now = time;
780 }
781
782 /**
783 * An alias for `this.reset()`, allowing the disposal of the `MockTimers` instance.

Callers 3

date.jsFile · 0.80
gc-js-interop.jsFile · 0.80

Calls 2

#assertTimeArgMethod · 0.95

Tested by

no test coverage detected