apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r125058 - /apr/apr/trunk/configure.in /apr/apr/trunk/time/unix/time.c /apr/apr/trunk/time/unix/timestr.c
Date Thu, 13 Jan 2005 10:48:25 GMT
Author: jorton
Date: Thu Jan 13 02:48:22 2005
New Revision: 125058

URL: http://svn.apache.org/viewcvs?view=rev&rev=125058
Log:
* configure.in: Require autoconf 2.50.  Use AC_CHECK_MEMBERS to check
for struct tm members tm_gmtoff and __tm_gmtoff (the check for
__tm_gmtoff seemed to be missing!).

* time/unix/time.c: Define NO_GMTOFF_IN_STRUCT_TM if neither member is found.
(get_offset, apr_os_exp_time_get, apr_os_exp_time_put): Use new macro names.
(apr_unix_setup_time): Use NO_GMTOFF_IN_STRUCT_TM.

* time/unix/timestr.c (apr_strftime): Use new macro names.

Modified:
   apr/apr/trunk/configure.in
   apr/apr/trunk/time/unix/time.c
   apr/apr/trunk/time/unix/timestr.c

Modified: apr/apr/trunk/configure.in
Url: http://svn.apache.org/viewcvs/apr/apr/trunk/configure.in?view=diff&rev=125058&p1=apr/apr/trunk/configure.in&r1=125057&p2=apr/apr/trunk/configure.in&r2=125058
==============================================================================
--- apr/apr/trunk/configure.in	(original)
+++ apr/apr/trunk/configure.in	Thu Jan 13 02:48:22 2005
@@ -4,6 +4,8 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl Use ./buildconf to prepare build files and run autoconf for APR.
 
+AC_PREREQ(2.50)
+
 AC_INIT(build/apr_common.m4)
 AC_CONFIG_HEADER(include/arch/unix/apr_private.h)
 AC_CONFIG_AUX_DIR(build)
@@ -1804,14 +1806,10 @@
 
 dnl ----------------------------- Checking for Time Support 
 echo "${nl}Checking for Time Support..."
-AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
-  ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
 
-if test "$ac_cv_struct_tm_gmtoff" = "yes"; then
-    AC_DEFINE(HAVE_GMTOFF, 1, [Define if struct tm has a tm_gmtoff field])
-fi
+AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[
+#include <sys/types.h>
+#include <time.h>])
 
 dnl ----------------------------- Checking for Networking Support 
 echo "${nl}Checking for Networking support..."

Modified: apr/apr/trunk/time/unix/time.c
Url: http://svn.apache.org/viewcvs/apr/apr/trunk/time/unix/time.c?view=diff&rev=125058&p1=apr/apr/trunk/time/unix/time.c&r1=125057&p2=apr/apr/trunk/time/unix/time.c&r2=125058
==============================================================================
--- apr/apr/trunk/time/unix/time.c	(original)
+++ apr/apr/trunk/time/unix/time.c	Thu Jan 13 02:48:22 2005
@@ -1,4 +1,4 @@
-/* Copyright 2000-2004 The Apache Software Foundation
+/* Copyright 2000-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -34,15 +34,16 @@
 #endif
 /* End System Headers */
 
-#if !defined(HAVE_GMTOFF) && !defined(HAVE___OFFSET)
+#if !defined(HAVE_STRUCT_TM_TM_GMTOFF) && !defined(HAVE_STRUCT_TM___TM_GMTOFF)
 static apr_int32_t server_gmt_offset;
-#endif /* if !defined(HAVE_GMTOFF) && !defined(HAVE___OFFSET) */
+#define NO_GMTOFF_IN_STRUCT_TM
+#endif          
 
 static apr_int32_t get_offset(struct tm *tm)
 {
-#ifdef HAVE_GMTOFF
+#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
     return tm->tm_gmtoff;
-#elif defined(HAVE___OFFSET)
+#elif defined(HAVE_STRUCT_TM___TM_GMTOFF)
     return tm->__tm_gmtoff;
 #else
 #ifdef NETWARE
@@ -54,7 +55,7 @@
         return server_gmt_offset + daylightOffset;
     }
 #else
-    if(tm->tm_isdst)
+    if (tm->tm_isdst)
         return server_gmt_offset + 3600;
 #endif
     return server_gmt_offset;
@@ -189,9 +190,9 @@
     (*ostime)->tm_yday = aprtime->tm_yday;
     (*ostime)->tm_isdst = aprtime->tm_isdst;
 
-#if HAVE_GMTOFF
+#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
     (*ostime)->tm_gmtoff = aprtime->tm_gmtoff;
-#elif defined(HAVE__OFFSET)
+#elif defined(HAVE_STRUCT_TM___TM_GMTOFF)
     (*ostime)->__tm_gmtoff = aprtime->tm_gmtoff;
 #endif
 
@@ -220,9 +221,9 @@
     aprtime->tm_yday = (*ostime)->tm_yday;
     aprtime->tm_isdst = (*ostime)->tm_isdst;
 
-#if HAVE_GMTOFF
+#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
     aprtime->tm_gmtoff = (*ostime)->tm_gmtoff;
-#elif defined(HAVE__OFFSET)
+#elif defined(HAVE_STRUCT_TM___TM_GMTOFF)
     aprtime->tm_gmtoff = (*ostime)->__tm_gmtoff;
 #endif
 
@@ -276,7 +277,7 @@
 #else
 APR_DECLARE(void) apr_unix_setup_time(void)
 {
-#if !defined(HAVE_GMTOFF) && !defined(HAVE___OFFSET)
+#ifdef NO_GMTOFF_IN_STRUCT_TM
     /* Precompute the offset from GMT on systems where it's not
        in struct tm.
 
@@ -316,7 +317,7 @@
     t.tm_isdst = 0; /* we know this GMT time isn't daylight-savings */
     t2 = mktime(&t);
     server_gmt_offset = (apr_int32_t) difftime(t1, t2);
-#endif
+#endif /* NO_GMTOFF_IN_STRUCT_TM */
 }
 
 #endif

Modified: apr/apr/trunk/time/unix/timestr.c
Url: http://svn.apache.org/viewcvs/apr/apr/trunk/time/unix/timestr.c?view=diff&rev=125058&p1=apr/apr/trunk/time/unix/timestr.c&r1=125057&p2=apr/apr/trunk/time/unix/timestr.c&r2=125058
==============================================================================
--- apr/apr/trunk/time/unix/timestr.c	(original)
+++ apr/apr/trunk/time/unix/timestr.c	Thu Jan 13 02:48:22 2005
@@ -1,4 +1,4 @@
-/* Copyright 2000-2004 The Apache Software Foundation
+/* Copyright 2000-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -142,9 +142,9 @@
     tm.tm_wday = xt->tm_wday;
     tm.tm_yday = xt->tm_yday;
     tm.tm_isdst = xt->tm_isdst;
-#if defined(HAVE_GMTOFF)
+#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
     tm.tm_gmtoff = xt->tm_gmtoff;
-#elif defined(HAVE___OFFSET)
+#elif defined(HAVE_STRUCT_TM___TM_GMTOFF)
     tm.__tm_gmtoff = xt->tm_gmtoff;
 #endif
     (*retsize) = strftime(s, max, format, &tm);

Mime
View raw message