// SPDX-License-Identifier: Apache-2.0
import { InvalidTimeUnits } from "./error/InvalidTimeUnits";
export class Time {
    static delay(time, unit) {
        let delayInMilliseconds;
        if (unit === "seconds" || unit === "sec") {
            delayInMilliseconds = time * 1000;
        }
        else if (unit === "milliseconds" || unit === "ms") {
            delayInMilliseconds = time;
        }
        else {
            throw new InvalidTimeUnits();
        }
        return new Promise((resolve) => setTimeout(() => resolve(true), delayInMilliseconds));
    }
}
