Skip to content

Commit

Permalink
We should be using a string constant for the strftime format string
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Oct 1, 2016
1 parent 7edd226 commit 9dfe540
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/test/SDL_test_log.c
Expand Up @@ -50,23 +50,19 @@
*
* \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)
{
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(&copy);
strftime(buffer, sizeof(buffer), fmt, local);
strftime(buffer, sizeof(buffer), "%x %X", local);

return buffer;
}
#pragma GCC diagnostic pop

/*
* Prints given message with a timestamp in the TEST category and INFO priority.
Expand Down

0 comments on commit 9dfe540

Please sign in to comment.