Just spent a couple of hours bug-hunting.
I couldn't understand why my geological survey ships seemed to be choosing asteroids at the far side of the system when auto-surveying. Couldn't find anything wrong with the code that selects the next body and it has been working for years anyway. I reset their courses a few times and it kept happening. Then I suddenly noticed almost straight after I set a course for one ship, the asteroid the ship was heading to wasn't there any more. After searching, I realised the asteroid had moved to the far side of the system. It quickly became apparent that the survey selection code was fine, but the asteroids themselves were changing to a mirror-image location during some orbital movement phases. Only asteroids - not planets. As they both used the same orbital movement code that was extremely weird.
I starting stepping through the code and realised the asteroids were orbiting at insane speed. More checks needed. Then I checked the database and realised that every asteroid in the game, except in the starting system, had an orbital period of one hour, regardless of distance. I checked the asteroid creation code and couldn't find a problem with the code that created the year length. The only situation in which the asteroid would be set to a one-hour year is if the orbital distance was zero. After more head scratching and code-stepping I finally realised that at some point during the code modifications to add star system design, I had accidentally moved the year-length algorithm after the orbital distance generation code, but only for asteroids, not planets. That meant that when the year-length algorithm ran for asteroids, the distance was still zero and the code selected one hour as the year. That one-hour year was causing the mirror-flipping for asteroids, which in turn was sending my geosurvey commanders insane
Sometimes bug-hunting can be a little obscure