From: wessels <> Date: Thu, 8 Apr 1999 13:09:00 +0000 (+0000) Subject: henrik sez: The time zone in common log format is miscalculated at X-Git-Tag: SQUID_3_0_PRE1~2294 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c308daa06b7809d201f4f6dfb5cf658bfbc1be4d;p=thirdparty%2Fsquid.git henrik sez: The time zone in common log format is miscalculated at the end of the year (any year, not a y2k specific problem even if next time it is visible is y2k..). --- diff --git a/lib/rfc1123.c b/lib/rfc1123.c index f9725e27af..9c1132811f 100644 --- a/lib/rfc1123.c +++ b/lib/rfc1123.c @@ -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,