-/*! \fn void getperiod_fromrange(struct periodstruct *period,int dfrom,int duntil)
-Fill the period with the specified range.
-
-\param period The period to change.
-\param dfrom The start date in the form year*10000+month*100+day.
-\param duntil The end date in the form year*10000+month*100+day.
-*/
-
-
-
-
-
/*! \fn int getperiod_buildtext(struct periodstruct *period)
Build the text to display as the date range of the report.
int vrfydir(const struct periodstruct *per1, const char *addr, const char *site, const char *us);
int getperiod_fromsarglog(const char *arqtt,struct periodstruct *period);
void getperiod_fromrange(struct periodstruct *period,int dfrom,int duntil);
+void getperiod_torange(const struct periodstruct *period,int *dfrom,int *duntil);
void getperiod_merge(struct periodstruct *main,struct periodstruct *candidate);
int getperiod_buildtext(struct periodstruct *period);
void removetmp(const char *outdir);
exit(EXIT_FAILURE);
}
- dfrom=(period.start.tm_year+1900)*10000+(period.start.tm_mon+1)*100+period.start.tm_mday;
- duntil=(period.end.tm_year+1900)*10000+(period.end.tm_mon+1)*100+period.end.tm_mday;
+ getperiod_torange(&period,&dfrom,&duntil);
if (NRedirectorLogs>0) {
for (i=0 ; i<NRedirectorLogs ; i++)
longline line;
FileListIterator FIter;
struct tm logtime;
+ int dfrom;
+ int duntil;
fp_ou=UserAgent_Open();
exit(EXIT_FAILURE);
}
memset(&logtime,0,sizeof(logtime));
+ getperiod_torange(&period,&dfrom,&duntil);
FIter=FileListIter_Open(UserAgentLog);
while ((FileName=FileListIter_Next(FIter))!=NULL)
return(-1);
}
+/*!
+Fill the period with the specified range.
+
+\param period The period to change.
+\param dfrom The start date in the form year*10000+month*100+day.
+\param duntil The end date in the form year*10000+month*100+day.
+*/
void getperiod_fromrange(struct periodstruct *period,int dfrom,int duntil)
{
memset(&period->start,0,sizeof(period->start));
period->end.tm_year=(duntil/10000)-1900;
}
+/*!
+Get the range from a period.
+
+\param period The period to convert to a range.
+\param dfrom The variable to store the range beginning. It can be NULL.
+\param duntil The variable to store the range end. It can be NULL.
+*/
+void getperiod_torange(const struct periodstruct *period,int *dfrom,int *duntil)
+{
+ if (dfrom)
+ *dfrom=(period->start.tm_year+1900)*10000+(period->start.tm_mon+1)*100+period->start.tm_mday;
+ if (duntil)
+ *duntil=(period->end.tm_year+1900)*10000+(period->end.tm_mon+1)*100+period->end.tm_mday;
+}
+
/*!
Update the \a main period to encompass the period in \a candidate.
*/