mirror of https://github.com/encounter/SDL.git
We should be using a string constant for the strftime format string
This commit is contained in:
parent
7edd2261e7
commit
9dfe54006e
|
@ -50,23 +50,19 @@
|
||||||
*
|
*
|
||||||
* \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02'
|
* \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02'
|
||||||
*/
|
*/
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
|
||||||
char *SDLTest_TimestampToString(const time_t timestamp)
|
char *SDLTest_TimestampToString(const time_t timestamp)
|
||||||
{
|
{
|
||||||
time_t copy;
|
time_t copy;
|
||||||
static char buffer[64];
|
static char buffer[64];
|
||||||
struct tm *local;
|
struct tm *local;
|
||||||
const char *fmt = "%x %X";
|
|
||||||
|
|
||||||
SDL_memset(buffer, 0, sizeof(buffer));
|
SDL_memset(buffer, 0, sizeof(buffer));
|
||||||
copy = timestamp;
|
copy = timestamp;
|
||||||
local = localtime(©);
|
local = localtime(©);
|
||||||
strftime(buffer, sizeof(buffer), fmt, local);
|
strftime(buffer, sizeof(buffer), "%x %X", local);
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prints given message with a timestamp in the TEST category and INFO priority.
|
* Prints given message with a timestamp in the TEST category and INFO priority.
|
||||||
|
|
Loading…
Reference in New Issue