/** * Enum which represents all the time units that can be derived from a Period * * Uppercase time units are absolute * Lowercase time units are relative to their parent units (e.g. minutes until last hour) * * Currently supported units: Seconds, Minutes, Hours and Days. * * @see {Period#getUnit} */ export declare enum TimeKey { s = 0, S = 1, m = 2, M = 3, h = 4, H = 5, D = 6, } export interface TimeValue { /** * Value of the instant with the given reference point. (Absolute or Relative, see TimeKey) */ value: number; /** * Whether the value is still significant, a value becomes non-significant if it passes a point where it * will ever be non-zero assuming the period only decreases. */ significant: boolean; } /** * A period represents an immutable positive length of time in seconds. * * This class has a number of methods to convert its length to different time scales, * see {@see Period#getUnit} for more information. */ export declare class Period { private seconds; /** * Create a period for the given length in seconds. * If the given length is negative it will be treated as if it was zero. * * @constructor * @param {number} seconds length of this period */ constructor(seconds: number); /** * A period with a length that is above zero will not be finished, any other lengths will be finished. */ isFinished(): boolean; /** * Alias for Period.getUnit(TimeKey.S).value * * Returns the total length of this period in seconds. */ toSeconds(): number; /** * Method to convert this period into other units of time. * * See {@see TimeKey} for the supported time units. * This method will return {@see TimeValue} describing the value in the given time unit. * * @param {string|number} key value key to convert to, see {@see TimeKey} for possible values. */ getUnit(key: string | TimeKey): TimeValue; /** * Determines whether the given period is equal to this period in terms of length. * * @param period the other period */ eq(period: Period): boolean; } /** * Factory method to create a period with a length equal to the given number of milliseconds. * * Be aware that the period will be limited to a precision in seconds and will be limited to positive values. * * @param {number} milliSeconds length of the created period in milliseconds */ export declare function ofMillis(milliSeconds: number): Period; /** * Factory method to create a period with a length equal to the given number of seconds. * * Be aware that the period will be limited to positive values. * * @param {number} seconds length of the created period in seconds */ export declare function ofSeconds(seconds: number): Period;