Fix elapsed time calculation