Report post

Are you sure you want to report the post shown below? This will send an email to the ATVO administrators. Please include a short reason for reporting.

Users reporting for no reason may be locked out.


Post

Posted by Nick Thissen
on
The Laps property should return a collection of all the laps that the car has completed. In principle you can loop over those laps and add up the "Time" property for each lap to get a total laptime. However in practice I fear this will not work very well because of several reasons, mostly:

- You must have been in the race the entire time from start to finish. If you connect halfway through a race, there is no way to obtain laptime information from laps already completed. Hence, your total laptime would only count the laps you observed, and nothing before that.
- Many times lap times return "invalid" meaning 0 seconds, for example for laps with black flags (corner cut etc) or even with incidents perhaps.

When you join a session halfway, we do add "placeholder" laps for every lap that was completed before you joined. For example, if you join in lap 18, then the Laps list will return 18 laps. However, the first 17 of them will have no laptime, because we don't know it.

You can try to get the total laptime with something as simple as this but like I said it will probably not work very well:
var totalTime = result.Laps.Sum(l => l.Time);