From d26fef415eb8f5b5dfbc9445682d5f688b9d4b01 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Fri, 30 Jan 2026 19:28:31 +0100
Subject: [PATCH] SDL_test: add --no-time option to not log times
Combining this new option with a known seed hash allows easy diff-ing between runs
---
src/test/SDL_test_common.c | 5 +++++
src/test/SDL_test_internal.h | 1 +
src/test/SDL_test_log.c | 6 ++++++
3 files changed, 12 insertions(+)
diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c
index f795a1a2db2e2..75be1352a9baa 100644
--- a/src/test/SDL_test_common.c
+++ b/src/test/SDL_test_common.c
@@ -43,6 +43,7 @@ static const char *common_usage[] = {
"[--trackmem]",
"[--randmem]",
"[--no-color]",
+ "[--no-time]",
"[--info all|video|modes|render|event|event_motion]",
"[--log all|error|system|audio|video|render|input]",
NULL
@@ -159,6 +160,10 @@ static int SDLCALL SDLTest_CommonStateParseCommonArguments(void *data, char **ar
SDLTest_Color = false;
return 1;
}
+ if (SDL_strcasecmp(argv[index], "--no-time") == 0) {
+ SDLTest_Time = false;
+ return 1;
+ }
if (SDL_strcasecmp(argv[index], "--randmem") == 0) {
/* Already handled in SDLTest_CommonCreateState() */
return 1;
diff --git a/src/test/SDL_test_internal.h b/src/test/SDL_test_internal.h
index f9a81302fdf65..4f276599af75f 100644
--- a/src/test/SDL_test_internal.h
+++ b/src/test/SDL_test_internal.h
@@ -22,6 +22,7 @@
#define SDL_test_internal_h
extern bool SDLTest_Color;
+extern bool SDLTest_Time;
#define COLOR_RAW_RED "\033[0;31m"
#define COLOR_RAW_GREEN "\033[0;32m"
diff --git a/src/test/SDL_test_log.c b/src/test/SDL_test_log.c
index 1aa4eefc932c7..bd579b73ce8b7 100644
--- a/src/test/SDL_test_log.c
+++ b/src/test/SDL_test_log.c
@@ -31,6 +31,8 @@
#include <time.h> /* Needed for localtime() */
+bool SDLTest_Time = true;
+
/* work around compiler warning on older GCCs. */
#if (defined(__GNUC__) && (__GNUC__ <= 2))
static size_t strftime_gcc2_workaround(char *s, size_t max, const char *fmt, const struct tm *tm)
@@ -61,6 +63,10 @@ static const char *SDLTest_TimestampToString(const time_t timestamp)
struct tm *local;
size_t result = 0;
+ if (!SDLTest_Time) {
+ return "";
+ }
+
SDL_memset(buffer, 0, sizeof(buffer));
copy = timestamp;
local = localtime(©);