/**
 * Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no. All rights reserved.
 * Modifications copyright (c) Microsoft Corporation.
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
 * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
import type { Builtins } from './utilityScript';
export type ClockConfig = {
    now?: number;
};
export type InstallConfig = ClockConfig & {
    toFake?: (keyof Builtins)[];
    browserName?: string;
};
declare enum TimerType {
    Timeout = "Timeout",
    Interval = "Interval",
    Immediate = "Immediate",
    AnimationFrame = "AnimationFrame",
    IdleCallback = "IdleCallback"
}
interface Embedder {
    dateNow(): number;
    performanceNow(): EmbedderTicks;
    setTimeout(task: () => void, timeout?: number): () => void;
    setInterval(task: () => void, delay: number): () => void;
}
type Ticks = number & {
    readonly __brand: 'Ticks';
};
type EmbedderTicks = number & {
    readonly __brand: 'EmbedderTicks';
};
type WallTime = number & {
    readonly __brand: 'WallTime';
};
type Time = {
    time: WallTime;
    ticks: Ticks;
    isFixedTime: boolean;
    origin: WallTime;
};
type LogEntryType = 'fastForward' | 'install' | 'pauseAt' | 'resume' | 'runFor' | 'setFixedTime' | 'setSystemTime';
export declare class ClockController {
    readonly _now: Time;
    private _duringTick;
    private _timers;
    private _uniqueTimerId;
    private _embedder;
    readonly disposables: (() => void)[];
    private _log;
    private _realTime;
    private _currentRealTimeTimer;
    constructor(embedder: Embedder);
    uninstall(): void;
    now(): number;
    install(time: number): void;
    setSystemTime(time: number): void;
    setFixedTime(time: number): void;
    performanceNow(): DOMHighResTimeStamp;
    private _syncRealTime;
    private _innerSetTime;
    private _innerInstall;
    private _innerSetFixedTime;
    private _advanceNow;
    log(type: LogEntryType, time: number, param?: number): Promise<void>;
    runFor(ticks: number): Promise<void>;
    private _runTo;
    pauseAt(time: number): Promise<number>;
    private _innerPause;
    resume(): void;
    private _innerResume;
    private _updateRealTimeTimer;
    private _runWithDisabledRealTimeSync;
    fastForward(ticks: number): Promise<void>;
    private _innerFastForwardTo;
    addTimer(options: {
        func: TimerHandler;
        type: TimerType;
        delay?: number | string;
        args?: any[];
    }): number;
    countTimers(): number;
    private _firstTimer;
    private _takeFirstTimer;
    private _callFirstTimer;
    getTimeToNextFrame(): number;
    clearTimer(timerId: number, type: TimerType): void;
    private _replayLogOnce;
}
export declare function createClock(globalObject: WindowOrWorkerGlobalScope, config?: InstallConfig): {
    clock: ClockController;
    api: Builtins;
    originals: Builtins;
};
export declare function install(globalObject: WindowOrWorkerGlobalScope, config?: InstallConfig): {
    clock: ClockController;
    api: Builtins;
    originals: Builtins;
};
export declare function inject(globalObject: WindowOrWorkerGlobalScope, browserName?: string): {
    controller: ClockController;
    builtins: Builtins;
};
export {};
//# sourceMappingURL=clock.d.ts.map