]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
henrik sez: The time zone in common log format is miscalculated at
authorwessels <>
Thu, 8 Apr 1999 13:09:00 +0000 (13:09 +0000)
committerwessels <>
Thu, 8 Apr 1999 13:09:00 +0000 (13:09 +0000)
the end of the year (any year, not a y2k specific problem even if
next time it is visible is y2k..).

lib/rfc1123.c

index f9725e27afe87d7bd4b0d6d60b2989865db39f86..9c1132811fd2f4aeda74c69d987057e08c8db1b0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: rfc1123.c,v 1.21 1998/11/12 06:30:15 wessels Exp $
+ * $Id: rfc1123.c,v 1.22 1999/04/08 07:09:00 wessels Exp $
  *
  * DEBUG: 
  * AUTHOR: Harvest Derived
@@ -119,7 +119,7 @@ parse_rfc1123(const char *str)
        s++;                    /* or: Thu, 10 Jan 1993 01:29:59 GMT */
        while (*s == ' ')
            s++;
-       if (isdigit(*s) && !isdigit(*(s+1))) /* backoff if only one digit */
+       if (isdigit(*s) && !isdigit(*(s + 1)))  /* backoff if only one digit */
            s--;
        if (strchr(s, '-')) {   /* First format */
            if ((int) strlen(s) < 18)
@@ -237,16 +237,17 @@ mkhttpdlogtime(const time_t * t)
     gmt_yday = gmt->tm_yday;
 
     lt = localtime(t);
-    day_offset = lt->tm_yday - gmt_yday;
-    min_offset = day_offset * 1440 + (lt->tm_hour - gmt_hour) * 60
-       + (lt->tm_min - gmt_min);
 
+    day_offset = lt->tm_yday - gmt_yday;
     /* wrap round on end of year */
     if (day_offset > 1)
        day_offset = -1;
     else if (day_offset < -1)
        day_offset = 1;
 
+    min_offset = day_offset * 1440 + (lt->tm_hour - gmt_hour) * 60
+       + (lt->tm_min - gmt_min);
+
     len = strftime(buf, 127 - 5, "%d/%b/%Y:%H:%M:%S ", lt);
     snprintf(buf + len, 128 - len, "%+03d%02d",
        (min_offset / 60) % 24,