/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
*/
/* quiet windows compiler warnings */
-#define _CRT_SECURE_NO_WARNINGS
+#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
+# define _CRT_SECURE_NO_WARNINGS
+#endif
#include "SDL_config.h"
#include "SDL_test.h"
+/* 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)
+{
+ return strftime(s, max, fmt, tm);
+}
+#ifdef strftime
+#undef strftime
+#endif
+#define strftime strftime_gcc2_workaround
+#endif
+
/* !
* Converts unix timestamp to its ascii representation in localtime
*
*
* \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02'
*/
-char *SDLTest_TimestampToString(const time_t timestamp)
+static char *SDLTest_TimestampToString(const time_t timestamp)
{
time_t copy;
static char buffer[64];
struct tm *local;
- const char *fmt = "%x %X";
SDL_memset(buffer, 0, sizeof(buffer));
copy = timestamp;
local = localtime(©);
- strftime(buffer, sizeof(buffer), fmt, local);
+ strftime(buffer, sizeof(buffer), "%x %X", local);
return buffer;
}
/* Log with timestamp and newline */
SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR, "%s: %s", SDLTest_TimestampToString(time(0)), logMessage);
}
+
+/* vi: set ts=4 sw=4 expandtab: */