You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by st...@locus.apache.org on 2000/06/16 17:09:54 UTC

cvs commit: apache-2.0/src/lib/apr/time/win32 time.c

stoddard    00/06/16 08:09:51

  Modified:    src      CHANGES
               src/lib/apr/time/win32 time.c
  Log:
  Win32: Fix problem with UTC offset not being correctly reported in the
  access log.
  
  Revision  Changes    Path
  1.154     +3 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.153
  retrieving revision 1.154
  diff -u -r1.153 -r1.154
  --- CHANGES	2000/06/16 12:00:57	1.153
  +++ CHANGES	2000/06/16 15:09:34	1.154
  @@ -1,4 +1,7 @@
   Changes with Apache 2.0a5
  +  *) Win32: Fix problem where UTC offset was not being set correctly
  +     in the access log. Problem reported on news group by Jerry Baker.
  +     [Bill Stoddard]
   
     *) Fix segfault when reporting this type of syntax error:
        "</container> without matching <container> section", where
  
  
  
  1.11      +23 -4     apache-2.0/src/lib/apr/time/win32/time.c
  
  Index: time.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/time/win32/time.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- time.c	2000/04/14 15:58:54	1.10
  +++ time.c	2000/06/16 15:09:43	1.11
  @@ -89,6 +89,9 @@
   
   void SystemTimeToAprExpTime(ap_exploded_time_t *xt, SYSTEMTIME *tm)
   {
  +    TIME_ZONE_INFORMATION tz;
  +    DWORD rc;
  +
       xt->tm_usec = tm->wMilliseconds * 1000;
       xt->tm_sec  = tm->wSecond;
       xt->tm_min  = tm->wMinute;
  @@ -98,8 +101,25 @@
       xt->tm_year = tm->wYear - 1900;
       xt->tm_wday = tm->wDayOfWeek;
       xt->tm_yday = 0; /* ToDo: need to compute this */
  -    xt->tm_isdst = 0; /* ToDo: need to compute this */
  -    xt->tm_gmtoff = 0; /* ToDo: maybe the caller should set this explicitly */
  +
  +    rc = GetTimeZoneInformation(&tz);
  +    switch (rc) {
  +    case TIME_ZONE_ID_UNKNOWN:
  +    case TIME_ZONE_ID_STANDARD:
  +        xt->tm_isdst = 0;
  +        /* Bias = UTC - local time in minutes 
  +         * tm_gmtoff is seconds east of UTC
  +         */
  +        xt->tm_gmtoff = tz.Bias * 60;
  +        break;
  +    case TIME_ZONE_ID_DAYLIGHT:
  +        xt->tm_isdst = 1;
  +        xt->tm_gmtoff = tz.Bias * 60;
  +        break;
  +    default:
  +        xt->tm_isdst = 0;
  +        xt->tm_gmtoff = 0;
  +    }
       return;
   }
   
  @@ -109,7 +129,7 @@
       return APR_SUCCESS;
   }
   
  -/* Return micro-seconds since the Unix epoch (jan. 1, 1970) */
  +/* Return micro-seconds since the Unix epoch (jan. 1, 1970) UTC */
   ap_time_t ap_now(void)
   {
       LONGLONG aprtime = 0;
  @@ -126,7 +146,6 @@
       AprTimeToFileTime(&ft, input);
       FileTimeToSystemTime(&ft, &st);
       SystemTimeToAprExpTime(result, &st);
  -    result->tm_gmtoff = 0;
       return APR_SUCCESS;
   }