"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.randomSleep = exports.secondsToTime = exports.getCurrentDate = void 0;
function getCurrentDate() {
    let dateStamp = 0;
    let date = new Date();
    const y = date.getFullYear();
    const m = date.getMonth() + 1;
    const d = date.getDate();
    dateStamp = y * 10000 + m * 100 + d;
    return dateStamp;
}
exports.getCurrentDate = getCurrentDate;
function secondsToTime(secs, plain = false) {
    let hours = Math.floor(secs / 3600);
    let divisor_for_minutes = secs % 3600;
    let minutes = Math.floor(divisor_for_minutes / 60);
    let divisor_for_seconds = divisor_for_minutes % 60;
    let seconds = Math.ceil(divisor_for_seconds);
    let h = hours.toString();
    let m = minutes.toString();
    let s = seconds.toString();
    if (hours.toString().length == 1) {
        h = '0' + hours;
    }
    if (minutes.toString().length == 1) {
        m = '0' + minutes;
    }
    if (seconds.toString().length == 1) {
        s = '0' + seconds;
    }
    if (plain == true) {
        return h + ":" + m + ":" + s;
    }
    return "\x1b[32m" + h + "\x1b[37mh\x1b[0m:"
        + "\x1b[32m" + m + "\x1b[37mm\x1b[0m:"
        + "\x1b[32m" + s + "\x1b[37ms\x1b[0m";
}
exports.secondsToTime = secondsToTime;
async function randomSleep(msMin = 15000, msMax = 60000) {
    return new Promise((res) => {
        setTimeout(res, Math.random() * (msMax - msMin) + msMin);
    });
}
exports.randomSleep = randomSleep;
//# sourceMappingURL=utils.js.map