From: Frédéric Marchal Date: Mon, 27 Aug 2012 12:31:33 +0000 (+0200) Subject: Fix the filtering out of the log based on a date X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d625117db489efe597edaeca0a12e550cfcff967;p=thirdparty%2Fsarg.git Fix the filtering out of the log based on a date The date range was ignored and, in the worst case, no entries were reported. --- diff --git a/readlog.c b/readlog.c index 16e6859..2f7cb68 100644 --- a/readlog.c +++ b/readlog.c @@ -332,6 +332,7 @@ int ReadLogFile(struct ReadLogDataStruct *Filter) break; } + idata=builddia(log_entry.EntryTime.tm_mday,log_entry.EntryTime.tm_mon+1,log_entry.EntryTime.tm_year+1900); if(debugm) printf("DATE=%s IDATA=%d DFROM=%d DUNTIL=%d\n",Filter->DateRange,idata,dfrom,duntil); diff --git a/readlog_common.c b/readlog_common.c index 39753da..9dcaff0 100644 --- a/readlog_common.c +++ b/readlog_common.c @@ -142,7 +142,7 @@ static enum ReadLogReturnCodeEnum Common_ReadEntry(char *Line,struct ReadLogStru if (*Line!=']') return(RLRC_Unknown); Entry->EntryTime.tm_year=Year-1900; - Entry->EntryTime.tm_mon=Month; + Entry->EntryTime.tm_mon=Month-1; Entry->EntryTime.tm_mday=Day; Entry->EntryTime.tm_hour=Hour; Entry->EntryTime.tm_min=Minute; diff --git a/readlog_extlog.c b/readlog_extlog.c index 91c8628..dde2b31 100644 --- a/readlog_extlog.c +++ b/readlog_extlog.c @@ -262,7 +262,7 @@ static char *ExtLog_GetDate(char *Line,struct tm *Date) ++Line; } Date->tm_year=year-1900; - Date->tm_mon=month; + Date->tm_mon=month-1; Date->tm_mday=day; return(Line); }