fix elapsed time calculation