+static struct time_criterion time_criteria[] = {
+
+ { "1h", 0, 1, -1, -1 },
+ { "2h", 0, 2, -1, -1 },
+ { "4h", 0, 4, -1, -1 },
+ { "8h", 0, 8, -1, -1 },
+ { "24h", 0, 24, -1, -1 },
+ { "48h", 0, 48, -1, -1 },
+ { "week", 0, 24 * 7, -1, -1 },
+ { "2weeks", 0, 24 * 14, -1, -1 },
+ { "month", 0, 24 * 31, -1, -1 },
+ { "semester", 0, 24 * 185, -1, -1 },
+ { "trimester", 0, 24 * 92, -1, -1 },
+ { "year", 0, 24 * 365, -1, -1 },
+
+ { "yesterday", 1, -1, -1, -1 },
+ { "today", 1, -1, -1, 0 },
+
+ { "monday", 1, -1, -1, 1 },
+ { "tuesday", 1, -1, -1, 2 },
+ { "wednesday", 1, -1, -1, 3 },
+ { "thursday", 1, -1, -1, 4 },
+ { "friday", 1, -1, -1, 5 },
+ { "saturday", 1, -1, -1, 6 },
+ { "sunday", 1, -1, -1, 7 },
+
+};
+
+/*********************************************************************/
+
+time_t time_for_past_day(int day) {
+ struct tm *tm;
+ int delta_day;
+ tm = localtime(&global_current_time);
+ if(day > 0) {
+ delta_day = (7 + tm->tm_wday - day) % 7;
+ } else {
+ delta_day = - day;
+ }
+ return global_current_time - (delta_day * 3600 * 24 + tm->tm_sec + 60 * tm->tm_min + 3600 * tm->tm_hour);
+}
+
+void init_condition(struct search_condition *condition, const char *full_string,
+ const char *default_search_field) {