"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.elapsedTimeToString = elapsedTimeToString;
exports.elapsedTimeDurationToString = elapsedTimeDurationToString;
function elapsedTimeToString(startTimeInMillis, stopTimeInMillis) {
    if (startTimeInMillis && stopTimeInMillis) {
        return elapsedTimeDurationToString(stopTimeInMillis - startTimeInMillis);
    }
    return elapsedTimeDurationToString(undefined);
}
function elapsedTimeDurationToString(elapsedTimeInMillis) {
    let elapsedTimeString = '--:--:--';
    if (elapsedTimeInMillis !== undefined) {
        if (elapsedTimeInMillis < 0) {
            elapsedTimeString =
                '-' + elapsedTimeDurationToString(elapsedTimeInMillis * -1);
        }
        else {
            const diffInSeconds = Math.round(elapsedTimeInMillis / 1000);
            const seconds = diffInSeconds % 60;
            const minutes = Math.floor(diffInSeconds / 60) % 60;
            const hours = Math.floor(diffInSeconds / (60 * 60));
            elapsedTimeString = `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
        }
    }
    return elapsedTimeString;
}
function pad(input) {
    return input.toString().padStart(2, '0');
}
