Skip to content

Commit

Permalink
fix server mainloop
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailRis committed Jan 30, 2025
1 parent 6eeb7a8 commit 0bbd215
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/engine/ServerMainloop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ void ServerMainloop::run() {

if (!coreParams.testMode) {
auto end = system_clock::now();
platform::sleep(targetDelta * 1000 -
duration_cast<microseconds>(end - begin).count() / 1000);
int64_t millis = targetDelta * 1000 -
duration_cast<microseconds>(end - begin).count() / 1000;
if (millis > 0) {
platform::sleep(millis);
}
begin = system_clock::now();
}
}
Expand Down

0 comments on commit 0bbd215

Please sign in to comment.