//#region src/common/time.d.ts /** * Set a fixed timestamp (ms since epoch) used by `getTimestamp` for tests. * * Pass a millisecond timestamp (for example created with Date.UTC) to force * time-based helpers to return deterministic values during tests. * * @param ts - timestamp in milliseconds (defaults to 2000-01-01T00:00:00.000Z) */ declare function setTimestampTest(ts?: number): void; /** * Return the current timestamp in milliseconds. * * In test mode (when `setTimestampTest` was called) the forced value is * returned instead of the real current time. * * @returns timestamp in milliseconds */ declare function getTimestamp(): number; /** * Return the current timestamp in seconds. * * Uses `getTimestamp()` which can be overridden for tests with * `setTimestampTest`. * * @returns timestamp in whole seconds (integer) */ declare function getTimestampInSeconds(): number; /** * Convert a UNIX timestamp in seconds to a JavaScript Date. * * @param ts - seconds since epoch * @returns Date instance corresponding to the provided seconds */ declare function dateFromSeconds(ts: number): Date; /** * Format a millisecond duration into a human readable string. * * - Values >= 1000ms are shown in seconds with one decimal (e.g. "1.2 s"). * - Smaller values are shown in milliseconds with two decimals (e.g. "123.45 ms"). * * @param ms - duration in milliseconds * @returns formatted duration string */ declare function formatMilliseconds(ms: number): string; /** * Parses the given date candidates and returns the first valid Date object found. * * @param dateCandidates - The date candidates to parse, which can be either strings or Date objects. * @returns The parsed Date object, or undefined if no valid date is found. */ declare function parseDate(...dateCandidates: (string | Date)[]): Date | undefined; /** * Return a high-resolution timestamp in milliseconds. * * Uses the `performance.now()` clock when available (monotonic, high * resolution), otherwise falls back to `Date.now()`. * * @returns timestamp in milliseconds (relative for performance.now, epoch for Date.now) */ declare function getPerformanceTimestamp(): number; /** * Create a simple duration reporter. * * Returns a function that, when called, reports the elapsed time since * `duration()` was called. The returned string is formatted via * `formatMilliseconds`. * * Example: const t = duration(); // do work...; console.log(t()); * * @returns a zero-argument function that returns the elapsed time string */ declare function duration(): () => string; /** * If you parsed a date string that didn't include a time zone, adjust the * naive UTC components into a local Date with the same Y/M/D/H/M/S values. * * This effectively treats the input as if it already represented local time * and builds a corresponding Date using the local timezone. */ declare function datetimeToLocal(fromDate: Date): Date; /** * If you parsed a date string that didn't include a time zone, adjust the * local date components into a UTC Date with the same Y/M/D/H/M/S values. */ declare function datetimeToUTC(fromDate: Date): Date; /** * Convert a timestamp in milliseconds to seconds. * * When `smart` is true the function will try to detect already-second * timestamps and return them unchanged (heuristic threshold). For example, * small numbers (< 1e12) are likely seconds and are returned as-is. * * @param ts - timestamp in milliseconds or seconds * @param smart - enable heuristic detection (default: true) * @returns timestamp in seconds */ declare function timestampMillisecondsToSeconds(ts: number, smart?: boolean): number; /** * Convert a timestamp in seconds to milliseconds. * * When `smart` is true the function tries to detect already-millisecond * values and returns them unchanged (heuristic threshold). Very large * numbers (> 1e12) are assumed to already be milliseconds. * * @param ts - timestamp in seconds or milliseconds * @param smart - enable heuristic detection (default: true) * @returns timestamp in milliseconds */ declare function timestampSecondsToMilliseconds(ts: number, smart?: boolean): number; /** Number of milliseconds in (approx.) one year (365 days). */ declare const TIME_YEAR_MS = 31536000000; /** Number of seconds in (approx.) one year (365 days). */ declare const TIME_YEAR_S = 31536000; /** Number of milliseconds in (approx.) one month (30 days). */ declare const TIME_MONTH_MS = 2592000000; /** Number of seconds in (approx.) one month (30 days). */ declare const TIME_MONTH_S = 2592000; /** Number of milliseconds in one week (7 days). */ declare const TIME_WEEK_MS = 604800000; /** Number of seconds in one week (7 days). */ declare const TIME_WEEK_S = 604800; /** Number of milliseconds in one day (24 hours). */ declare const TIME_DAY_MS = 86400000; /** Number of seconds in one day (24 hours). */ declare const TIME_DAY_S = 86400; /** Number of milliseconds in one hour (60 minutes). */ declare const TIME_HOUR_MS = 3600000; /** Number of seconds in one hour (60 minutes). */ declare const TIME_HOUR_S = 3600; /** Number of milliseconds in one minute (60 seconds). */ declare const TIME_MINUTE_MS = 60000; /** Number of seconds in one minute (60 seconds). */ declare const TIME_MINUTE_S = 60; /** Build number is minutes since 2025-01-01 in base32 "agnoster" encoded format */ declare function getBuildNumber(): string; declare function getSecondsFromBuildNumber(buildNumber: string): number; //#endregion export { parseDate as C, timestampSecondsToMilliseconds as E, getTimestampInSeconds as S, timestampMillisecondsToSeconds as T, formatMilliseconds as _, TIME_MINUTE_MS as a, getSecondsFromBuildNumber as b, TIME_MONTH_S as c, TIME_YEAR_MS as d, TIME_YEAR_S as f, duration as g, datetimeToUTC as h, TIME_HOUR_S as i, TIME_WEEK_MS as l, datetimeToLocal as m, TIME_DAY_S as n, TIME_MINUTE_S as o, dateFromSeconds as p, TIME_HOUR_MS as r, TIME_MONTH_MS as s, TIME_DAY_MS as t, TIME_WEEK_S as u, getBuildNumber as v, setTimestampTest as w, getTimestamp as x, getPerformanceTimestamp as y }; //# sourceMappingURL=time-BfKJBbym.d.cts.map