Calculation of finishing time