exit(EXIT_SUCCESS);
}
- if (ReadFilter.DateRange[0]!='\0') {
+ if (debug) {
char date0[30], date1[30];
+ struct tm Start,End;
- strftime(date0,sizeof(date0),"%d/%m/%Y",&period.start);
- strftime(date1,sizeof(date1),"%d/%m/%Y",&period.end);
+ GetLogPeriod(&Start,&End);
+ strftime(date0,sizeof(date0),"%x",&Start);
+ strftime(date1,sizeof(date1),"%x",&End);
+ // TRANSLATORS: The %s are the start and end dates in locale format.
debuga(_("Period covered by log files: %s-%s\n"),date0,date1);
+ strftime(date0,sizeof(date0),"%x",&period.start);
+ strftime(date1,sizeof(date1),"%x",&period.end);
+ // TRANSLATORS: The %s are the start and end dates in locale format.
+ debuga(_("Period extracted from log files: %s-%s\n"),date0,date1);
getperiod_fromrange(&period,dfrom,duntil);
}
if (getperiod_buildtext(&period)<0) {
exit(EXIT_FAILURE);
}
- if(debug)
- debuga(_("Period: %s\n"),period.text);
-
process_start_time=time(NULL);
if(DataFile[0] != '\0')
data_file(tmp);
static int maxdate=0;
//! Count the number of excluded records.
static unsigned long int excluded_count[ER_Last];
+//! Earliest date found in the log.
+static int EarliestDate=-1;
+//! The earliest date in time format.
+static struct tm EarliestDateTime;
+//! Latest date found in the log.
+static int LatestDate=-1;
+//! The latest date in time format.
+static struct tm LatestDateTime;
/*!
Read a single log file.
if(debugm)
printf("DATE=%s IDATA=%d DFROM=%d DUNTIL=%d\n",Filter->DateRange,idata,dfrom,duntil);
+ if (EarliestDate<0 || idata<EarliestDate) {
+ EarliestDate=idata;
+ memcpy(&EarliestDateTime,&log_entry.EntryTime,sizeof(struct tm));
+ }
+ if (LatestDate<0 || idata>LatestDate) {
+ LatestDate=idata;
+ memcpy(&LatestDateTime,&log_entry.EntryTime,sizeof(struct tm));
+ }
if(Filter->DateRange[0] != '\0'){
if(idata < dfrom || idata > duntil) {
excluded_count[ER_OutOfDateRange]++;
debuga(_("Log with invalid format\n"));
}
- if (debugz)
- debugaz(_("period=%s\n"),period.text);
-
return((totregsg!=0) ? 1 : 0);
}
+
+/*!
+ * Get the start and end date of the period covered by the log files.
+ */
+void GetLogPeriod(struct tm *Start,struct tm *End)
+{
+ if (EarliestDate>=0) {
+ memcpy(Start,&EarliestDateTime,sizeof(struct tm));
+ } else {
+ memset(Start,0,sizeof(struct tm));
+ }
+ if (LatestDate>=0) {
+ memcpy(End,&LatestDateTime,sizeof(struct tm));
+ } else {
+ memset(End,0,sizeof(struct tm));
+ }
+}