Skip to content

Fix NaT lap times after red flag restarts (issue #473)#925

Open
TumCucTom wants to merge 1 commit into
theOehrly:mainfrom
TumCucTom:fix/473-restart-lap-times
Open

Fix NaT lap times after red flag restarts (issue #473)#925
TumCucTom wants to merge 1 commit into
theOehrly:mainfrom
TumCucTom:fix/473-restart-lap-times

Conversation

@TumCucTom

@TumCucTom TumCucTom commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix lap times being set to NaT for drivers during standing restarts after red flags (formation laps).

During the Mexican GP 2023, a Red Flag was displayed on lap 34. Lap 35 began when VER crossed the line and entered the pit lane (formation lap behind SC). Lap 36 began when VER crossed the line and waited on the grid for the race to restart. In lap 36, the LapTime was recorded as NaT for the first 5 drivers (VER, HAM, LEC, SAI, RIC), while other drivers had LapTimes around 2 minutes 20 seconds.

The issue was that the lap synchronization logic in _laps_data_driver was attempting to use NaT LapTime values when adjusting lap start times, which corrupted the Time values for subsequent laps.

Changes

  • Added check in _laps_data_driver to skip the backward lap time sync adjustment when LapTime is NaT
  • Added check to skip the forward lap time sync adjustment when LapTime (of lap i) is NaT

Testing

Load Mexico 2023 race session and verify lap times are correct for drivers VER, HAM, LEC, SAI, RIC on lap 36.

Checklist

AI Disclosure

AI was used as a coding assistant. The human author reviewed all AI-generated code and changes.

During standing restarts after red flags (formation laps), some drivers
have their LapTime set to NaT in the API data. The lap synchronization
logic in _laps_data_driver was attempting to use these NaT LapTime
values when adjusting lap start times, which corrupted the Time values
for subsequent laps.

The fix adds checks to skip the lap time sync adjustment when LapTime
is NaT, since these special laps (formation laps, etc.) don't have
valid lap times to use for synchronization.

Co-Authored-By: Zippy AI <tomkinsbale@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant