Calculating time from seconds and time to seconds