def secondsToTime(secs): hours = float(secs / (60 * 60)) divisorForMinutes = secs % (60 * 60) minutes = float(divisorForMinutes / 60) divisorForSeconds = divisorForMinutes % 60 seconds = math.ceil(divisorForSeconds) obj = { 'h':hours, 'm':minutes, 's':seconds } return obj