diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index f795a1a2db..75be1352a9 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 f9a81302fd..4f276599af 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 1aa4eefc93..bd579b73ce 100644 --- a/src/test/SDL_test_log.c +++ b/src/test/SDL_test_log.c @@ -31,6 +31,8 @@ #include /* 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(©);