autofix method

void autofix()

Implementation

void autofix() {
  int totalSeconds = getTotalSeconds();
  if (totalSeconds < 0) totalSeconds = 0;

  int one_day = (1 * 60 * 60 * 24);
  int one_hour = (1 * 60 * 60);
  int one_minute = (1 * 60);

  int days = (totalSeconds / 60 / 60 / 24).round();
  totalSeconds -= (days * one_day);

  int hours = (totalSeconds / 60 / 60).round();
  totalSeconds -= (hours * one_hour);

  int minutes = (totalSeconds / 60).round();
  totalSeconds -= (minutes * one_minute);

  int seconds = totalSeconds;

  this.days = days;
  this.hours = hours;
  this.minutes = minutes;
  this.seconds = seconds;
}