Skip to content
Snippets Groups Projects
Commit f9c7a844 authored by rswindell's avatar rswindell
Browse files

Use ctime_r() for the error.log timestamp string rather thean timestr() -

this insures:
1. the timestamp always includes the seconds
2. the tiemstamp is always in 24-hour format (no am/pm indication)

For systems that are configured (in SCFG) for "Military" (24 hour) time format,
the error.log timestamps should appear the same as before.
parent ae3c34f6
No related branches found
No related tags found
No related merge requests found
...@@ -122,12 +122,13 @@ extern "C" int DLLCALL errorlog(scfg_t* cfg, const char* host, const char* text) ...@@ -122,12 +122,13 @@ extern "C" int DLLCALL errorlog(scfg_t* cfg, const char* host, const char* text)
FILE* fp; FILE* fp;
char buf[128]; char buf[128];
char path[MAX_PATH+1]; char path[MAX_PATH+1];
time_t now = time(NULL);
SAFEPRINTF(path, "%serror.log", cfg->logs_dir); SAFEPRINTF(path, "%serror.log", cfg->logs_dir);
if((fp = fnopen(NULL,path,O_WRONLY|O_CREAT|O_APPEND))==NULL) if((fp = fnopen(NULL,path,O_WRONLY|O_CREAT|O_APPEND))==NULL)
return -1; return -1;
fprintf(fp,"%s %s%s%s%s%s" fprintf(fp,"%.24s %s%s%s%s%s"
,timestr(cfg,time32(NULL),buf) ,ctime_r(&now, buf)
,host==NULL ? "":host ,host==NULL ? "":host
,log_line_ending ,log_line_ending
,text ,text
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment