def secondsToHMS(intervalInSeconds):
    """converts time in seconds to a string representing time in hours, minutes, and seconds
    
        :param intervalInSeconds: a time measured in seconds
        
        :returns: time in HH:MM:SS format
    """
    interval = [0, 0, intervalInSeconds]
    interval[0] = (interval[2] / 3600) - ((interval[2] % 3600) / 3600)
    interval[1] = ((interval[2] % 3600) / 60) - ((interval[2] % 3600) % 60) / 60
    interval[2] = interval[2] % 60

    intervalString = '{0:02.0f}:{1:02.0f}:{2:02.0f}'.format(interval[0],
      interval[1], interval[2])

    return intervalString