calculation of time spent