updated time calculation