function convertMillisecToHumanReadable()

in src/scaler/scaler-core/utils.js [32:48]


function convertMillisecToHumanReadable(millisec) {
  // By Nofi @ https://stackoverflow.com/a/32180863
  const seconds = millisec / 1000;
  const minutes = millisec / (1000 * 60);
  const hours = millisec / (1000 * 60 * 60);
  const days = millisec / (1000 * 60 * 60 * 24);

  if (seconds < 60) {
    return seconds.toFixed(1) + ' Sec';
  } else if (minutes < 60) {
    return minutes.toFixed(1) + ' Min';
  } else if (hours < 24) {
    return hours.toFixed(1) + ' Hrs';
  } else {
    return days.toFixed(1) + ' Days';
  }
}