]> git.kaiwu.me - nginx.git/commitdiff
Refactored ngx_parse_time().
authorRuslan Ermilov <ru@nginx.com>
Mon, 16 Mar 2015 21:26:18 +0000 (00:26 +0300)
committerRuslan Ermilov <ru@nginx.com>
Mon, 16 Mar 2015 21:26:18 +0000 (00:26 +0300)
No functional changes.

src/core/ngx_parse.c

index 79f22f05e3670aaa9d6de9c2396151750e3413c0..aa385bf0eb194b7597d9b5484ae74cde9d01a5b2 100644 (file)
@@ -121,7 +121,6 @@ ngx_parse_time(ngx_str_t *line, ngx_uint_t is_sec)
     value = 0;
     total = 0;
     step = is_sec ? st_start : st_month;
-    scale = is_sec ? 1 : 1000;
 
     p = line->data;
     last = p + line->len;
@@ -239,7 +238,6 @@ ngx_parse_time(ngx_str_t *line, ngx_uint_t is_sec)
         }
 
         value = 0;
-        scale = is_sec ? 1 : 1000;
 
         while (p < last && *p == ' ') {
             p++;
@@ -247,7 +245,7 @@ ngx_parse_time(ngx_str_t *line, ngx_uint_t is_sec)
     }
 
     if (valid) {
-        return total + value * scale;
+        return total + value * (is_sec ? 1 : 1000);
     }
 
     return NGX_ERROR;