diff --git a/servlog.c b/servlog.c index 64375adf..15b4919e 100644 --- a/servlog.c +++ b/servlog.c @@ -268,7 +268,26 @@ static const char* timestamp(struct timeval *tp) { { strncpy(pFile,pChar,255); } - snprintf(filnam,511,"%s%2.2d.log",pFile, iFile); + + // Jing added here to add timestamp info for the server00.log file name as server00_hh:mm:sec-daymonyear.log + if(iFile==0){ + int hh, mm, ss, day, mon, year; + struct timeval tv; + struct tm *time; + + gettimeofday(&tv, NULL); + time = localtime(&tv.tv_sec); + hh = time->tm_hour; + mm = time->tm_min; + ss = time->tm_sec; + day = time->tm_mday; + mon = time->tm_mon; + year = time->tm_year + 1900; + + snprintf(filnam,511,"%s%2.2d_%02d:%02d:%02d-%02d%02d%04d.log",pFile, iFile, hh, mm, ss, day, mon, year); + }else + snprintf(filnam,511,"%s%2.2d.log",pFile, iFile); + fLogFile = fopen(filnam,"w"); if(!fLogFile) {