/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { CancelablePromise } from "#util/Cancelable.js";
import type { Lifetime } from "#util/Lifetime.js";
import { Diagnostic } from "../log/Diagnostic.js";
import { Duration } from "./Duration.js";
import type { Timestamp } from "./Timestamp.js";
/**
 * Timer and date/time management interface.
 *
 * You may replace this platform abstraction but we provide an implementation compatible with any standard JS
 * environment.
 */
export declare class Time {
    static default: Time;
    static startup: {
        systemMs: Timestamp;
        processMs: Timestamp;
    };
    get now(): Date;
    static get now(): Date;
    get nowMs(): number;
    static get nowMs(): Timestamp;
    get nowUs(): Timestamp;
    static get nowUs(): Timestamp;
    /**
     * Create a timer that will call callback after durationMs has passed.
     */
    getTimer(_name: string, _duration: Duration, _callback: Timer.Callback): Timer;
    static readonly getTimer: (name: string, duration: Duration, callback: Timer.Callback) => Timer;
    /**
     * Create a timer that will periodically call callback at intervalMs intervals.
     */
    getPeriodicTimer(_name: string, _duration: Duration, _callback: Timer.Callback): Timer;
    static readonly getPeriodicTimer: (name: string, duration: Duration, callback: Timer.Callback) => Timer;
    /**
     * Create a promise that resolves after a specific interval or when canceled, whichever comes first.
     */
    sleep(name: string, duration: Duration): CancelablePromise;
    static sleep(name: string, duration: Duration): CancelablePromise<void>;
    static register(timer: Timer): void;
    static unregister(timer: Timer): void;
    static get timers(): Set<Timer>;
}
export interface Timer {
    /** Name (diagnostics) */
    name: string;
    /** Set to true to indicate the timer should not prevent program exit */
    utility: boolean;
    /** System ID (diagnostics) */
    systemId: unknown;
    /** Interval (diagnostics) */
    interval: Duration;
    /** Is the timer periodic? (diagnostics) */
    isPeriodic: boolean;
    /** Amount of time interval has been active (diagnostics) */
    elapsed?: Diagnostic.Elapsed;
    /** Is true if this timer is running. */
    isRunning: boolean;
    /** Starts this timer, chainable. */
    start(): Timer;
    /** Stops this timer, chainable. */
    stop(): Timer;
}
export declare namespace Timer {
    type Callback = (lifetime: Lifetime) => any;
}
//# sourceMappingURL=Time.d.ts.map