API reference › @evolu/common › Time › Time

Defined in: packages/common/src/Time.ts:50

Time and timer operations.

Extended by

Properties

clearTimeout

readonly clearTimeout: (id: TimeoutId) => void;

Defined in: packages/common/src/Time.ts:84

Cancels a timeout scheduled with this instance's Time.setTimeout.

Throws if the timeout was scheduled by another Time instance.


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:51

Call Signature

(): number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative"> & Brand<"LessThan281474976710655"> & Brand<"Millis">;

Returns current time as Unix epoch milliseconds.

Call Signature

(type: "DateIso"): string & Brand<"DateIso">;

Returns current time as an ISO 8601 UTC string.


performance

readonly performance: {
  now: () => PerformanceTime;
  timeOrigin: PerformanceTimeOrigin;
};

Defined in: packages/common/src/Time.ts:59

NameTypeDescriptionDefined in
now()() => PerformanceTimeReturns 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:73
timeOriginPerformanceTimeOriginUnix epoch timestamp used as the origin for performance.now().packages/common/src/Time.ts:61

setTimeout

readonly setTimeout: (fn: () => void, delay: PositiveDuration) => TimeoutId;

Defined in: packages/common/src/Time.ts:77

Schedules a callback after the specified positive delay.