"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.readableDuration = void 0;
const network_1 = require("../../network");
/**
 * Returns a string in the format 'HH:MM:SS.mmm' representing the duration between the given start and end times.
 * @param startTime The start time in milliseconds (shardusGetTime()).
 * @param endTime The end time in milliseconds. If not provided, the current time will be used.
 */
function readableDuration(startTime, endTime = undefined) {
    if (endTime === undefined)
        endTime = (0, network_1.shardusGetTime)();
    let difference = endTime - startTime;
    const hours = Math.floor(difference / (1000 * 60 * 60));
    difference -= hours * 1000 * 60 * 60;
    const minutes = Math.floor(difference / (1000 * 60));
    difference -= minutes * 1000 * 60;
    const seconds = Math.floor(difference / 1000);
    difference -= seconds * 1000;
    const milliseconds = difference;
    return `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}.${String(milliseconds).padStart(3, '0')}`;
}
exports.readableDuration = readableDuration;
//# sourceMappingURL=readableDuration.js.map