timer static method

TimeValue timer({
  1. required int seconds,
})

convert total second to time value seconds, minutes, hours, days

Implementation

static TimeValue timer({required int seconds}) {
  TimeValue timeValue = TimeValue();
  timeValue.days = seconds ~/ (24 * 3600);

  seconds = seconds % (24 * 3600);
  timeValue.hours = seconds ~/ 3600;

  seconds %= 3600;
  timeValue.minutes = seconds ~/ 60;

  seconds %= 60;
  timeValue.seconds = seconds;

  return timeValue;
}