Re: Incorrect date/time - is it just me?

From: Dancer <dancer@dont-contact.us>
Date: Mon, 23 Feb 1998 22:47:17 +1000

I noticed the same a few hours ago (seconds before the power went off). It
seems to think that it's Epoch.
Also v1.1.20

D

David J N Begley wrote:

> I noticed something with ftpget/1.1.20 today that I thought was "new"; I
> was wondering if anyone else agrees that this is "wrong" (despite it being
> mainly cosmetic).
>
> Using Squid/1.1.20, do a query using ftp:// (ie., force usage of ftpget)
> that requests a known non-existant FTP URL. The "Generated" date/time at
> the bottom of the error page is "Thu, 01 Jan 1970 00:00:00 GMT" instead
> of a more contemporary date/time. Oops! A quick check of a nearby
> Squid/1.1.16 shows what I expected. I kinda suspect this didn't happen
> with Squid/1.1.18, but I don't want to reinstall it just to find out!
>
> A quick compare of the 1.1.18 vs 1.1.20 sources indicates a switch from
> using http_time() to using mkrfc1123() for generating these dates/times.
> The respective routines are:
>
> [src/ftpget.c-1.1.18]
> static const char *
> http_time(time_t t)
> {
> struct tm *gmt;
> time_t when;
> static char tbuf[128];
>
> when = t ? t : time(NULL);
> gmt = gmtime(&when);
> strftime(tbuf, 128, "%A, %d-%b-%y %H:%M:%S GMT", gmt);
> return tbuf;
> }
>
> [lib/rfc1123.c-1.1.20]
> const char *
> mkrfc1123(time_t t)
> {
> static char buf[128];
>
> struct tm *gmt = gmtime(&t);
>
> buf[0] = '\0';
> strftime(buf, 127, RFC1123_STRFTIME, gmt);
> return buf;
> }
>
> Presumably this is something to do with mkrfc1123() being called with a
> NULL param. Call me crazy, but shouldn't there be a call to "time(NULL)"
> in that second routine (either that, or the NULL call to mkrfc1123 should
> be changed in ftpget.c)?
>
> As I said, mainly cosmetic.
>
> Cheers..
>
> dave
>
> *** squid-1.1.20/lib/rfc1123.c.orig Thu Jan 8 09:59:34 1998
> --- squid-1.1.20/lib/rfc1123.c Mon Feb 23 23:35:37 1998
> ***************
> *** 271,279 ****
> mkrfc1123(time_t t)
> {
> static char buf[128];
>
> ! struct tm *gmt = gmtime(&t);
> !
> buf[0] = '\0';
> strftime(buf, 127, RFC1123_STRFTIME, gmt);
> return buf;
> --- 271,280 ----
> mkrfc1123(time_t t)
> {
> static char buf[128];
> + struct tm *gmt;
>
> ! t = t ? t : time(NULL); /* time(t), anyone? ;-) */
> ! gmt = gmtime(&t);
> buf[0] = '\0';
> strftime(buf, 127, RFC1123_STRFTIME, gmt);
> return buf;

--
Did you read the documentation AND the FAQ?
If not, I'll probably still answer your question, but my patience will
be limited, and you take the risk of sarcasm and ridicule.
Received on Mon Feb 23 1998 - 04:53:07 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:38:57 MST