API reference › @evolu/common › Time › TestTime
Defined in: packages/common/src/Time.ts:191
Test Time with controllable timers.
Call advance(ms) to move time forward and trigger any pending timeouts.
Extends
Properties
advance
readonly advance: (duration: Duration) => void;
Defined in: packages/common/src/Time.ts:198
Advances time by the specified duration, triggering pending timeouts.
Timeout callback errors propagate and leave time at the callback's deadline. Throws if called while another advance is in progress.
clearTimeout
readonly clearTimeout: (id: TimeoutId) => void;
Defined in: packages/common/src/Time.ts:63
Cancels a timeout scheduled with this instance's Time.setTimeout.
Throws if the timeout was scheduled by another Time instance.
Inherited from
now
readonly now: {
(): number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative"> & Brand<"LessThan281474976710655"> & Brand<"Millis">;
(type: "DateIso"): string & Brand<"DateIso">;
};
Defined in: packages/common/src/Time.ts:30
Call Signature
(): number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative"> & Brand<"LessThan281474976710655"> & Brand<"Millis">;
Returns current time as Unix epoch milliseconds.
Returns
number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative"> & Brand<"LessThan281474976710655"> & Brand<"Millis">
Call Signature
(type: "DateIso"): string & Brand<"DateIso">;
Returns current time as an ISO 8601 UTC string.
Parameters
| Parameter | Type |
|---|---|
type | "DateIso" |
Returns
string & Brand<"DateIso">
Inherited from
performance
readonly performance: {
now: () => PerformanceTime;
timeOrigin: PerformanceTimeOrigin;
};
Defined in: packages/common/src/Time.ts:38
| Name | Type | Description | Defined in |
|---|---|---|---|
now() | () => PerformanceTime | Returns a high-resolution timestamp in milliseconds relative to performance.timeOrigin. Unlike Time.now, this value is not Unix epoch time and is unaffected by system clock adjustments. Like Node.js process.hrtime.bigint(), it is suitable for measuring elapsed time, but it uses the Web Performance API's number representation rather than nanoseconds as a bigint. | packages/common/src/Time.ts:52 |
timeOrigin | PerformanceTimeOrigin | Unix epoch timestamp used as the origin for performance.now(). | packages/common/src/Time.ts:40 |
Inherited from
setTimeout
readonly setTimeout: (fn: () => void, delay: PositiveDuration) => TimeoutId;
Defined in: packages/common/src/Time.ts:56
Schedules a callback after the specified positive delay.