calculate time spent in each task