comparison src/core/ngx_parse.c @ 6084:54da18a533df stable-1.6

Refactored ngx_parse_time(). No functional changes.
author Ruslan Ermilov <ru@nginx.com>
date Tue, 17 Mar 2015 00:26:18 +0300
parents 516d8e299273
children 429a8c65f0a7
comparison
equal deleted inserted replaced
6083:516d8e299273 6084:54da18a533df
119 119
120 valid = 0; 120 valid = 0;
121 value = 0; 121 value = 0;
122 total = 0; 122 total = 0;
123 step = is_sec ? st_start : st_month; 123 step = is_sec ? st_start : st_month;
124 scale = is_sec ? 1 : 1000;
125 124
126 p = line->data; 125 p = line->data;
127 last = p + line->len; 126 last = p + line->len;
128 127
129 while (p < last) { 128 while (p < last) {
237 if ((ngx_uint_t) total > NGX_MAX_INT32_VALUE) { 236 if ((ngx_uint_t) total > NGX_MAX_INT32_VALUE) {
238 return NGX_ERROR; 237 return NGX_ERROR;
239 } 238 }
240 239
241 value = 0; 240 value = 0;
242 scale = is_sec ? 1 : 1000;
243 241
244 while (p < last && *p == ' ') { 242 while (p < last && *p == ' ') {
245 p++; 243 p++;
246 } 244 }
247 } 245 }
248 246
249 if (valid) { 247 if (valid) {
250 return total + value * scale; 248 return total + value * (is_sec ? 1 : 1000);
251 } 249 }
252 250
253 return NGX_ERROR; 251 return NGX_ERROR;
254 } 252 }