API reference@evolu/common › Time

Time representations, durations, and scheduling utilities.

Functions

FunctionDescription
createTimeCreates a Time using Date.now(), performance, and globalThis.setTimeout.
durationToMillisConverts a duration to milliseconds.
formatMillisAsClockTimeFormats Millis as local time in HH:MM:SS.mmm format.
formatMillisAsDurationFormats Millis as a human-readable duration string.
millisToDateIsoConverts Millis to DateIso.
performanceDurationBetweenReturns the elapsed fractional milliseconds between two performance times.
saturateMillisConverts a number to Millis, rounding to the nearest millisecond and saturating overflow at maxMillis.
testCreateTimeCreates a TestTime with controllable timers for testing.

Interfaces

InterfaceDescription
TestTimeTest Time with controllable timers.
TestTimeDep-
TimeTime and timer operations.
TimeDep-

Type Aliases

Type AliasDescription
DurationDurationLiteral or Millis.
DurationLiteralDuration literal Type with compile-time and runtime validation.
DurationLiteralDaysDays duration: "1d" to "6d" or "1.1d" to "6.9d". See DurationLiteral.
DurationLiteralHoursHours duration: "1h" to "23h" or "1.1h" to "23.9h". See DurationLiteral.
DurationLiteralMillisecondsMilliseconds duration: "1ms" to "999ms". See DurationLiteral.
DurationLiteralMinutesMinutes duration: "1m" to "59m" or "1.1m" to "59.9m". See DurationLiteral.
DurationLiteralSecondsSeconds duration: "1s" to "59s" or "1.1s" to "59.9s". See DurationLiteral.
DurationLiteralWeeksWeeks duration: "1w" to "51w" or "1.1w" to "51.9w". See DurationLiteral.
DurationLiteralYearsYears duration: "1y" to "99y" or "1.1y" to "99.9y". See DurationLiteral.
MillisNon-negative integer milliseconds used for timestamps and durations.
PerformanceDurationElapsed fractional milliseconds measured using PerformanceTime.
PerformanceTimeHigh-resolution milliseconds elapsed since PerformanceTimeOrigin.
PerformanceTimeOriginUnix epoch milliseconds used as the origin for PerformanceTime.
PositiveDurationDurationLiteral or PositiveMillis.
PositiveMillisPositive Millis value.
TimeoutIdOpaque type for timeout handles.

Variables

VariableDescription
DurationLiteralDuration literal Type with compile-time and runtime validation.
DurationLiteralDaysDays duration: "1d" to "6d" or "1.1d" to "6.9d". See DurationLiteral.
DurationLiteralHoursHours duration: "1h" to "23h" or "1.1h" to "23.9h". See DurationLiteral.
DurationLiteralMillisecondsMilliseconds duration: "1ms" to "999ms". See DurationLiteral.
DurationLiteralMinutesMinutes duration: "1m" to "59m" or "1.1m" to "59.9m". See DurationLiteral.
DurationLiteralSecondsSeconds duration: "1s" to "59s" or "1.1s" to "59.9s". See DurationLiteral.
DurationLiteralWeeksWeeks duration: "1w" to "51w" or "1.1w" to "51.9w". See DurationLiteral.
DurationLiteralYearsYears duration: "1y" to "99y" or "1.1y" to "99.9y". See DurationLiteral.
maxMillisMaximum Millis value.
MillisNon-negative integer milliseconds used for timestamps and durations.
minMillisMinimum Millis value.
ms120fpsFrame budget at 120fps (8ms).
ms60fpsFrame budget at 60fps (16ms).
msLongTaskLong task threshold (50ms).
PositiveMillisPositive Millis value.