You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2001/06/22 19:53:50 UTC

cvs commit: apr/time/unix time.c

trawick     01/06/22 10:53:50

  Modified:    .        CHANGES
               time/unix time.c
  Log:
  Solaris doesn't have (struct tm *)->tm_gmtoff, so the server logs
  were written in GMT regardess of the system timezone.
  (The well-known Solaris headache)
  
  The Solaris-kludge did exist and worked in 2.0.16 of
  srclib/apr/time/unix/time.c:apr_explode_localtime(), but the code
  was moved from apr_explode_localtime() to set_xt_gmtoff_from_tm()
  around version 1.38.
  
  So the attached patch will use tm_to_exp() (which calls
  set_xt_gmtoff_from_tm()) in apr_explode_localtime(), which fixed the
  problem.
  
  PR:		7902
  Submitted by:	Taketo Kabe <ka...@sra-tohoku.co.jp>
  Reviewed by:	Jeff Trawick
  
  Revision  Changes    Path
  1.115     +4 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.114
  retrieving revision 1.115
  diff -u -r1.114 -r1.115
  --- CHANGES	2001/06/19 20:40:28	1.114
  +++ CHANGES	2001/06/22 17:53:49	1.115
  @@ -1,4 +1,8 @@
   Changes with APR b1  
  +
  +  *) Fix gmt offset handling on Solaris.  Apache log messages now show
  +     local time again. PR #7902 [Taketo Kabe <ka...@sra-tohoku.co.jp>]
  +
     *) apr_pstrcat() optimizations [Doug MacEachern, Jeff Trawick]
   
     *) Make the apr_pool_is_ancestor logic public.  This is required for 
  
  
  
  1.43      +4 -13     apr/time/unix/time.c
  
  Index: time.c
  ===================================================================
  RCS file: /home/cvs/apr/time/unix/time.c,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- time.c	2001/04/19 22:01:06	1.42
  +++ time.c	2001/06/22 17:53:49	1.43
  @@ -154,25 +154,16 @@
       return apr_explode_time(result, input, -timezone);
   #else
       time_t mango = input / APR_USEC_PER_SEC;
  -    apr_int32_t offs = 0;
   
   #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
       struct tm mangotm;
       localtime_r(&mango, &mangotm);
  -/* XXX - Add support for Solaris */
  -#ifdef HAVE_GMTOFF
  -    offs = mangotm.tm_gmtoff;
  -#elif defined(HAVE___OFFSET)
  -    offs = mangotm.__tm_gmtoff;
  -#endif
   #else /* !APR_HAS_THREADS */
  -    struct tm *mangotm;
  -    mangotm=localtime(&mango);
  -#ifdef HAVE_GMTOFF
  -    offs = mangotm->tm_gmtoff;
  -#endif    
  +    struct tm mangotm;
  +    mangotm = *localtime(&mango);
   #endif
  -    return apr_explode_time(result, input, offs);
  +    tm_to_exp(result, &mangotm, &mango);
  +    return APR_SUCCESS;
   #endif /* __EMX__ */
   }