Skip to content
Permalink
Browse files

general: replaced obsolete POSIX asctime with strftime, refs #1247

  • Loading branch information...
rmarquis committed Apr 12, 2019
1 parent b0b9fa6 commit f5fbf9263fd9fa86650920e19b954a575637d70a
Showing with 13 additions and 11 deletions.
  1. +7 −3 src/game/g_main.c
  2. +6 −8 src/qcommon/common.c
@@ -2236,6 +2236,7 @@ void G_InitGame(int levelTime, int randomSeed, int restart, int legacyServer, in
int i;
char cs[MAX_INFO_STRING];
time_t aclock;
char timeFt[32];
char *logDate;

G_Printf("------- Game Initialization -------\ngamename: %s\ngamedate: %s\n", GAMEVERSION, __DATE__);
@@ -2386,7 +2387,8 @@ void G_InitGame(int levelTime, int randomSeed, int restart, int legacyServer, in

// time
time(&aclock);
G_Printf("gametime: %s\n", asctime(localtime(&aclock)));
strftime(timeFt, sizeof(timeFt), "%a %b %d %X %Y", localtime(&aclock));
G_Printf("gametime: %s\n", timeFt);

G_ParseCampaigns();
if (g_gametype.integer == GT_WOLF_CAMPAIGN)
@@ -2424,7 +2426,7 @@ void G_InitGame(int levelTime, int randomSeed, int restart, int legacyServer, in
{
if (trap_FS_FOpenFile(g_log.string, &level.logFile, FS_WRITE) >= 0)
{
logDate = va("logfile opened on %s\n", asctime(localtime(&aclock)));
logDate = va("logfile opened on %s\n", timeFt);

trap_FS_Write(logDate, strlen(logDate), level.logFile);
trap_FS_FCloseFile(level.logFile);
@@ -2657,6 +2659,7 @@ void G_InitGame(int levelTime, int randomSeed, int restart, int legacyServer, in
void G_ShutdownGame(int restart)
{
time_t aclock;
char timeFt[32];

#ifdef FEATURE_LUA
G_LuaHook_ShutdownGame(restart);
@@ -2683,7 +2686,8 @@ void G_ShutdownGame(int restart)

// time
time(&aclock);
G_Printf("gametime: %s\n", asctime(localtime(&aclock)));
strftime(timeFt, sizeof(timeFt), "%a %b %d %X %Y", localtime(&aclock));
G_Printf("gametime: %s\n", timeFt);

#ifdef FEATURE_OMNIBOT
if (!Bot_Interface_Shutdown())
@@ -257,21 +257,19 @@ void QDECL Com_Printf(const char *fmt, ...)
// also, avoid recursing in the qconsole.log opening (i.e. if fs_debug is on)
if (!logfile && FS_Initialized() && !opening_qconsole)
{
struct tm *newtime;
time_t aclock;
time_t aclock;
char timeFt[32];

opening_qconsole = qtrue;

time(&aclock);
newtime = localtime(&aclock);

logfile = FS_FOpenFileWrite("etconsole.log");

if (logfile)
{
// FIXME: Obsolete function 'asctime' called. It is recommended to use 'strftime' instead.
// Does we really need to change it ?
Com_Printf("logfile opened on %s\n", asctime(newtime));
time(&aclock);
strftime(timeFt, sizeof(timeFt), "%a %b %d %X %Y", localtime(&aclock));
Com_Printf("logfile opened on %s\n", timeFt);

if (com_logfile->integer > 1)
{
// force it to not buffer so we get valid

0 comments on commit f5fbf92

Please sign in to comment.
You can’t perform that action at this time.