comparison src/core/ngx_times.c @ 4782:e23892a0c917

Fixed possible use of old cached times if runtime went backwards. If ngx_time_sigsafe_update() updated only ngx_cached_err_log_time, and then clock was adjusted backwards, the cached_time[slot].sec might accidentally match current seconds on next ngx_time_update() call, resulting in various cached times not being updated. Fix is to clear the cached_time[slot].sec to explicitly mark cached times are stale and need updating.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 03 Aug 2012 09:10:39 +0000
parents 67653855682e
children 777202558122
comparison
equal deleted inserted replaced
4781:814541b2ec23 4782:e23892a0c917
208 if (slot == NGX_TIME_SLOTS - 1) { 208 if (slot == NGX_TIME_SLOTS - 1) {
209 slot = 0; 209 slot = 0;
210 } else { 210 } else {
211 slot++; 211 slot++;
212 } 212 }
213
214 tp = &cached_time[slot];
215
216 tp->sec = 0;
213 217
214 ngx_gmtime(sec + cached_gmtoff * 60, &tm); 218 ngx_gmtime(sec + cached_gmtoff * 60, &tm);
215 219
216 p = &cached_err_log_time[slot][0]; 220 p = &cached_err_log_time[slot][0];
217 221