fixed waiting till heat death problem

This commit is contained in:
Pierre committed 2026-09-30 21:46:28 +02:00
1 parent f7e2d85e37
commit b3dcc9aa66
2 files changed
+2 -2

No files matched your search

+2 -1
View File
@@ -31,9 +31,9 @@ void *physics(void *args) {
universe_t *uni = (universe_t *)args;
struct timespec ot, ct;
while (true) {
clock_gettime(CLOCK_MONOTONIC, &ct);
mechanics(uni);
ot = ct;
clock_gettime(CLOCK_MONOTONIC, &ct);
long long elapsed = timespec_diff_ns(ct, ot);
long long remaining = TIMESTEP / simx - elapsed;
@@ -46,6 +46,7 @@ void *physics(void *args) {
do {
clock_gettime(CLOCK_MONOTONIC, &ct);
printf("Waiting !\n");
} while (timespec_diff_ns(ct, ot) < TIMESTEP / simx);
}
}