+static void verify_timestamp(const ex_t *ex, const char *line) {
+ struct tm tm;
+
+ /* localtime_r to set tm's timezone */
+ time_t now_time = time(NULL);
+ if (localtime_r(&now_time, &tm) == NULL)
+ die_err("Can't unpack current time?");
+
+ const char *strptime_result = strptime(line, "%Y %m %d %H %M %S", &tm);
+ if (strptime_result == NULL || strptime_result != &line[TIMESTAMP_LEN])
+ die("Wrong contents in log file: Couldn't parse timestamp");
+ time_t t = mktime(&tm);
+ int t_in_range = ex->a <= t && t <= ex->b;
+ if (!t_in_range)
+ die("Wrong contents in log file: Wrong time");
+}
+