Wrote functions for total time and longest time.