We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The platform time-stamp is cast from double to int32 without any overflow checks.
double
int32
The OS time seems to fit fine on Linux, that's why we didn't noticed before, but fails on Windows. Nevertheless, the code is wrong in both platforms.
The relevant code is in ACarlaPlayerState::UpdateTimeStamp().
ACarlaPlayerState::UpdateTimeStamp()
As quick workaround until we fix this, you can apply the following patch to add an offset to prevent the overflow
--- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaPlayerState.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaPlayerState.cpp @@ -77,8 +77,9 @@ static int32 RoundToMilliseconds(float Seconds) void ACarlaPlayerState::UpdateTimeStamp(float DeltaSeconds) { + static const auto offset = FPlatformTime::Seconds(); FrameNumber = GFrameCounter; SimulationStepInSeconds = DeltaSeconds; - PlatformTimeStamp = RoundToMilliseconds(FPlatformTime::Seconds()); + PlatformTimeStamp = RoundToMilliseconds(FPlatformTime::Seconds() - offset); GameTimeStamp += RoundToMilliseconds(DeltaSeconds); }
The text was updated successfully, but these errors were encountered:
Interesting fact, Unreal on Windows adds a big number to the platform time-stamp precisely to find similar bugs
// add big number to make bugs apparent where return value is being passed to float return Cycles.QuadPart * GetSecondsPerCycle() + 16777216.0;
Sorry, something went wrong.
nsubiron
Successfully merging a pull request may close this issue.
The platform time-stamp is cast from
double
toint32
without any overflow checks.The OS time seems to fit fine on Linux, that's why we didn't noticed before, but fails on Windows. Nevertheless, the code is wrong in both platforms.
The relevant code is in
ACarlaPlayerState::UpdateTimeStamp()
.As quick workaround until we fix this, you can apply the following patch to add an offset to prevent the overflow
The text was updated successfully, but these errors were encountered: