diff options
Diffstat (limited to 'parsing.c')
-rw-r--r-- | parsing.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -280,12 +280,17 @@ static void process_file(FILE *f, struct channel_t *channel, struct regexset_t * } pcre_copy_named_substring(rs->log_opened, line, ovector, rc, "date", date, DATE_BUFFER_SIZE); + + /* TODO: Find a better way around this. + * Locking early to allow setting of correct date before any other threads start setting time + * before date is set. */ + pthread_mutex_lock(&time_mutex); if(!strptime(date, log_date_format, &now)) { fprintf(stderr, "log fail: %s\n", date); + pthread_mutex_unlock(&time_mutex); continue; } - pthread_mutex_lock(&time_mutex); now_global = now; pthread_mutex_unlock(&time_mutex); @@ -302,12 +307,15 @@ static void process_file(FILE *f, struct channel_t *channel, struct regexset_t * } pcre_copy_named_substring(rs->day_changed, line, ovector, rc, "date", date, DATE_BUFFER_SIZE); + + /* See comment in log_opened parsing. */ + pthread_mutex_lock(&time_mutex); if(!strptime(date, day_date_format, &now)) { fprintf(stderr, "day fail: %s\n", date); + pthread_mutex_unlock(&time_mutex); continue; } - pthread_mutex_lock(&time_mutex); now_global = now; pthread_mutex_unlock(&time_mutex); |