/*
- find mistakes in the given source code
- lines with incorrect code are commented, with the correct input below

[] take seconds as user input
[] return seconds, minutes, hours as struct
*/

#include <stdio.h>

// struct _Time_
typedef struct _Time_
{
  int seconds_;
  int minutes_;
  int hours_;
  //};
} Time;

Time convertTime(int total_seconds);

int main(void)
{
  int total_seconds = 0;
  //Time time;
  Time time = {0, 0, 0};

  printf("Total number of seconds: ");
  //scanf("%c", &total_seconds);
  scanf("%d", &total_seconds);

  //time = convertTime(total_seconds)
  time = convertTime(total_seconds);

  printf("%-8s %8d\n%-8s %8d\n%-8s %8d\n", "Hours:", time.hours_, "Minutes:", time.minutes_, "Seconds:", time.seconds_);

  return 0;
}

//float convertTime(total_seconds)
Time convertTime(int total_seconds)
{
  Time result;

  result.hours_ = total_seconds / 3600;
  total_seconds = total_seconds % 3600;
  result.minutes_ = total_seconds / 60;
  //result.seconds_ = total_seconds * 60;
  result.seconds_ = total_seconds % 60;

  return result;
}
