You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ha...@hyperreal.com> on 1996/02/23 19:29:06 UTC

DATE_LOCAL / DATE_GMT incorrect TZ label (fwd)

ack sent.

Forwarded message:
> From ajb@j300151323.resnet.cornell.edu  Fri Feb 23 08:58:25 1996
> Date: Fri, 23 Feb 1996 23:58:49 -0500
> From: Andrew Berkley <aj...@j300151323.resnet.cornell.edu>
> Message-Id: <19...@j300151323.resnet.cornell.edu>
> To: apache-bugs@apache.org
> Subject: DATE_LOCAL / DATE_GMT incorrect TZ label
> 
> If a page contains:
>         <br>sent to you: <!--#echo var="DATE_LOCAL" -->
>         <br>(that's: <!--#echo var="DATE_GMT" -->)
> The result is:
>         sent to you: Wednesday, 21-Feb-96 23:30:09 EST
>         (that's: Thursday, 22-Feb-96 04:30:09 EST)
> The times are right, but shouldn't the label on the second be GMT.
> We are using Apache 1.0.2 (apache 1.0.3 doesn't fix this) on
> linux 1.2.12.
> 
> Here's my take on the problem:
> mod_include.c:
> void add_include_vars(request_rec *r, char *timefmt)
> ...
>     table_set(e, "DATE_LOCAL", ht_time(r->pool, date, timefmt, 0));
>     table_set(e, "DATE_GMT", ht_time(r->pool, date, timefmt, 1));
> ...
> 
> with timefmt => #define DEFAULT_TIME_FORMAT "%A, %d-%b-%y %T %Z"
> 
> util.c:
> char *ht_time(pool *p, time_t t, char *fmt, int gmt) {
>     char ts[MAX_STRING_LEN];
>     struct tm *tms;
> 
>     tms = (gmt ? gmtime(&t) : localtime(&t));
> 
>     /* check return code? */
>     strftime(ts,MAX_STRING_LEN,fmt,tms);
>     return pstrdup (p, ts);
> }
> 
> Perhaps I'm misunderstanding something, but strftime("%Z") prints
> the current time zone of the machine -- which is always going to
> be EST for me...  Hiding a gmt ? "GMT" : "%Z" somewhere in the code
> would fix the problem.
> 
> Andrew Berkley
> Applied and Engineering Physics '97
> Cornell University
>