calculation of time