Calculation of horizontal distance and time