/**
 * @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;
    /**
     * The current wall-clock time as a millisecond {@link Timestamp}.
     *
     * Backed by {@link Date.now} so it tracks UTC including clock adjustments (e.g. NTP steps). Use this for absolute
     * time such as epoch values sent on the wire.
     */
    get nowMs(): Timestamp;
    static get nowMs(): Timestamp;
    /**
     * The current time as a high-resolution {@link Timestamp}.
     *
     * Backed by {@link performance} so it carries sub-millisecond precision where the platform supports it (falling
     * back to {@link nowMs} otherwise). It is monotonic and may drift from UTC, so use it for relative/elapsed timing,
     * not for absolute wall-clock values.
     *
     * Despite the name the value is a millisecond {@link Timestamp}, not microseconds. Use
     * {@link Timestamp.toMicroseconds} to obtain a microsecond value.
     */
    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;
    /**
     * Defer to a new macrotask.
     */
    get macrotask(): Promise<void>;
    static get macrotask(): Promise<void>;
    /**
     * 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