string convertSecToTimeOfDay(int sec) {
int start = timeTracker.getSimStartTime();
int timeOfDay = sec + start; //start is how many seconds from midnight the sim started.
//now do the same as the other methods...exept.. don't want days.
//filter out days by modding with seconds in days.
int secsInCurrentDay = timeOfDay % 86400;
//get in hours.
int hoursInCurrentDay = secsInCurrentDay / 3600;
//get seconds left this hour.
int secsInCurrentHour = secsInCurrentDay % 3600;
//get in minutes.
int minutesInCurrentHour = secsInCurrentHour / 60;
//gets seconds left this minute.
int secondsInCurrentMinute = secsInCurrentHour % 60;
//get am/pm.
string ampm = "AM";
if (hoursInCurrentDay > 11) ampm = "PM";
//convert hours to 12 hour time.
hoursInCurrentDay = hoursInCurrentDay % 12;
//build string.
string s = hoursInCurrentDay.ToString("00") + ":" + minutesInCurrentHour.ToString("00") + ":" + secondsInCurrentMinute.ToString("00") + " " + ampm;
return s;
}