/** * Defines a range in time that may be * - fixed, i.e., `start` and `end` are absolute timestamps (both inclusive), or * - dynamic, i.e., `end` is always `now()` or `now() - offset`. */ export declare class TimeRange { /** The duration of this time range. */ readonly duration: Duration; /** The offset from `now()` if this time range has a dynamic offset. */ readonly offset?: Duration; /** * The end timestamp. * * - If this is a positive integer, it is a fixed end timestamp for the time range. * - If this is `undefined` and `offset` is also `undefined, the time range always ends `now()`. * - If this is `undefined` and `offset` is set, the time range ends at `now() - offset`. */ private endTimestamp?; /** * The Unix timestamp in milliseconds precision when this time range starts (inclusive). * * This value is computed using `end` and `duration`. */ get start(): number; /** * The Unix timestamp in milliseconds precision when this time range ends (inclusive) */ get end(): number; /** * Creates a new `TimeRange` with the dynamic values: * - `start = now() - duration` * - `end = now()` */ static fromDuration(duration: Duration): TimeRange; /** * Creates a new `TimeRange` with the dynamic values: * - `start = end() - duration` * - `end = now() - offset` */ static fromDurationWithOffset(offset: Duration, duration: Duration): TimeRange; /** * Creates a new `TimeRange` with the specified `duration` that always ends `now()`. * * @param duration The `Duration` of this time range. */ constructor(duration: Duration); /** * Creates a new `TimeRange` with the specified `duration` that always ends `now() - offset`. * * @param duration The `Duration` of this time range. * @param offset The offset from `now()`, at which this time range should end. */ constructor(duration: Duration, offset: Duration); /** * Creates a new `TimeRange` with the specified `duration` and a fixed `end` timestamp. * * @param duration The `Duration` of this time range. * @param end The Unix timestamp, at which the time range ends (inclusive). */ constructor(duration: Duration, end: number); /** * @returns `true` if this time range always ends `now()`, i.e., at the time it is evaluated, * otherwise `false`. */ endsNow(): boolean; } /** * Defines a time duration with millisecond precision. */ export declare class Duration { /** The duration in milliseconds. */ readonly valueMs: number; static fromHours(hours: number): Duration; static fromMinutes(minutes: number): Duration; static fromSeconds(seconds: number): Duration; static fromMilliseconds(ms: number): Duration; protected constructor(valueMs: number); }