API reference › @evolu/common › Time
Time representations, durations, and scheduling utilities.
Functions
| Function | Description |
|---|---|
| createTime | Creates a Time using Date.now() and globalThis.setTimeout. |
| durationToMillis | Converts a duration to milliseconds. |
| formatMillisAsClockTime | Formats Millis as HH:MM:SS.mmm. |
| formatMillisAsDuration | Formats Millis as a human-readable duration string. |
| millisToDateIso | Converts Millis to DateIso. |
| setTimeout | Returns a Promise that resolves after the specified duration. |
| testCreateTime | Creates a TestTime with controllable timers for testing. |
Interfaces
| Interface | Description |
|---|---|
| TestTime | Test Time with controllable timers. |
| TestTimeDep | - |
| Time | Time and timer operations. |
| TimeDep | - |
Type Aliases
| Type Alias | Description |
|---|---|
| Duration | Duration can be either a DurationLiteral or milliseconds as Millis. |
| DurationLiteral | Duration literal with compile-time validation. |
| DurationLiteralDays | Days duration: "1d" to "6d" or "1.1d" to "6.9d". See DurationLiteral. |
| DurationLiteralHours | Hours duration: "1h" to "23h" or "1.1h" to "23.9h". See DurationLiteral. |
| DurationLiteralMilliseconds | Milliseconds duration: "1ms" to "999ms". See DurationLiteral. |
| DurationLiteralMinutes | Minutes duration: "1m" to "59m" or "1.1m" to "59.9m". See DurationLiteral. |
| DurationLiteralSeconds | Seconds duration: "1s" to "59s" or "1.1s" to "59.9s". See DurationLiteral. |
| DurationLiteralWeeks | Weeks duration: "1w" to "51w" or "1.1w" to "51.9w". See DurationLiteral. |
| DurationLiteralYears | Years duration: "1y" to "99y" or "1.1y" to "99.9y". See DurationLiteral. |
| Millis | Milliseconds timestamp, like Date.now(). |
| TimeoutId | Opaque type for timeout handles. |
Variables
| Variable | Description |
|---|---|
| maxMillis | Maximum Millis value. |
| Millis | Milliseconds timestamp, like Date.now(). |
| minMillis | Minimum Millis value. |
| ms120fps | Frame budget at 120fps (8ms). |
| ms60fps | Frame budget at 60fps (16ms). |
| msLongTask | Long task threshold (50ms). |