- flush autologfile faster

This commit is contained in:
zolliker
2007-09-25 06:56:06 +00:00
parent 460921f324
commit 660f0c8b54

View File

@ -34,6 +34,8 @@
/*-------------------- the tail buffer ---------------------------------*/ /*-------------------- the tail buffer ---------------------------------*/
static pCircular pTail = NULL; static pCircular pTail = NULL;
#define MAXTAIL 1000 #define MAXTAIL 1000
/*----------------------------------------------------------------------*/
static time_t tLastWrite = 0;
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
void WriteToCommandLog(char *prompt,char *text) void WriteToCommandLog(char *prompt,char *text)
{ {
@ -113,6 +115,7 @@
/* automatic file */ /* automatic file */
if(fauto != NULL) if(fauto != NULL)
{ {
time(&tLastWrite);
if(iNL) if(iNL)
{ {
fprintf(fauto,"%s %s",prompt, pText); fprintf(fauto,"%s %s",prompt, pText);
@ -316,6 +319,11 @@
fflush(fauto); fflush(fauto);
} }
if (fauto && tLastWrite != 0 && tNow > tLastWrite) {
fflush(fauto);
tLastWrite = 0;
}
return iEnd; return iEnd;
} }
/*----------- a command to configure the log --------------------------*/ /*----------- a command to configure the log --------------------------*/