You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by br...@hyperreal.org on 1998/05/06 04:32:21 UTC

cvs commit: apache-1.2/src CHANGES util.c

brian       98/05/05 19:32:20

  Modified:    src      CHANGES util.c
  Log:
  PR: 754
  Submitted by:	Paul Eggert <eg...@twinsun.com>
  
    *) Fix handling of %Z in timefmt strings for those platforms with no time
       zone information in their tm struct.
  
  Revision  Changes    Path
  1.306     +4 -0      apache-1.2/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.2/src/CHANGES,v
  retrieving revision 1.305
  retrieving revision 1.306
  diff -u -r1.305 -r1.306
  --- CHANGES	1998/04/01 11:48:11	1.305
  +++ CHANGES	1998/05/06 02:32:19	1.306
  @@ -1,5 +1,9 @@
   Changes with Apache 1.2.7
   
  +  *) Fix handling of %Z in timefmt strings for those platforms with no time
  +     zone information in their tm struct. [Paul Eggert <eg...@twinsun.com>]
  +     PR #754
  +
     *) Fix a typo in url parsing code that could cause it to read past
        end of buffer.  [Patrick Bihan-Faou <pb...@gandalf.com>] PR#2019
   
  
  
  
  1.57      +34 -0     apache-1.2/src/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.2/src/util.c,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- util.c	1998/04/13 11:45:49	1.56
  +++ util.c	1998/05/06 02:32:19	1.57
  @@ -82,9 +82,43 @@
   
   char *ht_time(pool *p, time_t t, const char *fmt, int gmt) {
       char ts[MAX_STRING_LEN];
  +    char tf[MAX_STRING_LEN];
       struct tm *tms;
   
       tms = (gmt ? gmtime(&t) : localtime(&t));
  +    if(gmt) {
  +      /* Convert %Z to "GMT" and %z to "+0000";
  +       * on hosts that do not have a time zone string in struct tm,
  +       * strftime must assume its argument is local time.
  +       */
  +      const char *f;
  +      char *p;
  +      for(p = tf, f = fmt; p < tf + sizeof tf - 5 && (*p = *f); f++, p++) {
  +        if(*f == '%')
  +          switch(f[1])
  +            {
  +            case '%':
  +              *++p = *++f;
  +              break;
  +            case 'Z':
  +              *p++ = 'G';
  +              *p++ = 'M';
  +              *p = 'T';
  +              f++;
  +              break;
  +            case 'z': /* common extension */
  +              *p++ = '+';
  +              *p++ = '0';
  +              *p++ = '0';
  +              *p++ = '0';
  +              *p = '0';
  +              f++;
  +              break;
  +            }
  +      }
  +      *p = '\0';
  +      fmt = tf;
  +    }
   
       /* check return code? */
       strftime(ts,MAX_STRING_LEN,fmt,tms);