/*********************************************************************/
+time_t time_for_past_day(int day) {
+ time_t t;
+ struct tm *tm;
+ int delta_day;
+ t = time(0);
+ tm = localtime(&t);
+ delta_day = (7 + tm->tm_wday - day) % 7 + 1;
+ return t - delta_day * 3600 * 24 + tm->tm_sec + 60 * tm->tm_min + 3600 * tm->tm_hour;
+}
+
+/*********************************************************************/
+
int ignore_entry(const char *name) {
return
/* strcmp(name, ".") == 0 || */
condition->interval_stop = 0;
}
+ else if(strcmp(search_field, "monday") == 0) {
+ condition->field_id = ID_INTERVAL;
+ condition->interval_start = time_for_past_day(1);
+ condition->interval_stop = condition->interval_start + 3600 * 24;
+ }
+
+ else if(strcmp(search_field, "tuesday") == 0) {
+ condition->field_id = ID_INTERVAL;
+ condition->interval_start = time_for_past_day(2);
+ condition->interval_stop = condition->interval_start + 3600 * 24;
+ }
+
+ else if(strcmp(search_field, "wednesday") == 0) {
+ condition->field_id = ID_INTERVAL;
+ condition->interval_start = time_for_past_day(3);
+ condition->interval_stop = condition->interval_start + 3600 * 24;
+ }
+
+ else if(strcmp(search_field, "thursday") == 0) {
+ condition->field_id = ID_INTERVAL;
+ condition->interval_start = time_for_past_day(4);
+ condition->interval_stop = condition->interval_start + 3600 * 24;
+ }
+
+ else if(strcmp(search_field, "friday") == 0) {
+ condition->field_id = ID_INTERVAL;
+ condition->interval_start = time_for_past_day(5);
+ condition->interval_stop = condition->interval_start + 3600 * 24;
+ }
+
+ else if(strcmp(search_field, "saturday") == 0) {
+ condition->field_id = ID_INTERVAL;
+ condition->interval_start = time_for_past_day(6);
+ condition->interval_stop = condition->interval_start + 3600 * 24;
+ }
+
+ else if(strcmp(search_field, "sunday") == 0) {
+ condition->field_id = ID_INTERVAL;
+ condition->interval_start = time_for_past_day(7);
+ condition->interval_stop = condition->interval_start + 3600 * 24;
+ }
+
else if(strcmp(search_field, "yesterday") == 0) {
condition->field_id = ID_INTERVAL;
condition->interval_start = time(0) - 2 * 3600 * 24;
- condition->interval_stop = time(0) - 3600 * 24;
+ condition->interval_stop = condition->interval_start + 3600 * 24;
}
else {