Add function to convert time to seconds