From 0a93ac129475ab3ce11af95969f767d60e98233a Mon Sep 17 00:00:00 2001
From: Cameron Cawley <[EMAIL REDACTED]>
Date: Sun, 8 May 2022 18:06:47 +0100
Subject: [PATCH] Work around the lack of clock() on PS Vita
---
src/test/SDL_test_harness.c | 2 +-
src/test/SDL_test_random.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test/SDL_test_harness.c b/src/test/SDL_test_harness.c
index ec67d997786..2e94f6c28ce 100644
--- a/src/test/SDL_test_harness.c
+++ b/src/test/SDL_test_harness.c
@@ -349,7 +349,7 @@ static void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
/* Gets a timer value in seconds */
static float GetClock()
{
- float currentClock = clock() / (float) CLOCKS_PER_SEC;
+ float currentClock = SDL_GetPerformanceCounter() / (float) SDL_GetPerformanceFrequency();
return currentClock;
}
diff --git a/src/test/SDL_test_random.c b/src/test/SDL_test_random.c
index c52e050bba8..b2babf18c8c 100644
--- a/src/test/SDL_test_random.c
+++ b/src/test/SDL_test_random.c
@@ -70,7 +70,7 @@ void SDLTest_RandomInitTime(SDLTest_RandomContext * rndContext)
srand((unsigned int)time(NULL));
a=rand();
- srand((unsigned int)clock());
+ srand((unsigned int)SDL_GetPerformanceCounter());
b=rand();
SDLTest_RandomInit(rndContext, a, b);
}