about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-06-13 19:30:40 -0400
committerCharadon <dev@iotib.net>2022-06-13 19:30:40 -0400
commita232dc6b19489adb361a178e07f4e3dc668a8cad (patch)
tree385709fa3532372a473a93838ad0c13b84fa204d /src
parentaa72570a7df37e789c06f77e4617f717f69a63f5 (diff)
downloadPong-C-a232dc6b19489adb361a178e07f4e3dc668a8cad.tar.gz
Revert "Third try"
This reverts commit d491de9371c4e62ee26f49729c0e3da32c5db336.
Diffstat (limited to 'src')
-rw-r--r--src/main.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index 923fa22..ef07c98 100644
--- a/src/main.c
+++ b/src/main.c
@@ -50,7 +50,7 @@ void set_screen_mode() {
 
 static int internal_clock() {
 	const struct timespec Delay = {
-		0, 99999
+		0, 16666666
 	};
 	struct timespec Remaining = {
 		0, 0
@@ -60,13 +60,11 @@ static int internal_clock() {
 		double OldTime = GetTime();
 		nanosleep(&Delay, &Remaining);
 		double NewTime = GetTime();
-		while((NewTime-OldTime) > (1.0/60.0f)) {
+		printf("%lf,%lf,%d,%lf\n", OldTime, NewTime, SDL_AtomicGet(&Ticks), (NewTime-OldTime));
+		while((OldTime-NewTime) > (1.0/60.0f)) {
 			NewTime = GetTime();
+			printf("%lf\n", (OldTime-NewTime));
 		}
-		while((NewTime-OldTime) < (1.0/60.0f)) {
-			NewTime = GetTime();
-		}
-		printf("%lf, %lf\n", (NewTime-OldTime), (1.0/60.0f));
 	}
 	return(0);
 }