apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Travis <jtra...@covalent.net>
Subject Re: Time funniness between HPUX and everyone else
Date Thu, 10 Jan 2002 18:04:51 GMT
Someone want to commit this?  

-- Jon


Index: time.c
===================================================================
RCS file: /var/covalent/.CVS/apache-cvs/apr-cvs/time/unix/time.c,v
retrieving revision 1.58
diff -u -r1.58 time.c
--- time.c	2002/01/02 20:12:34	1.58
+++ time.c	2002/01/09 20:50:14
@@ -92,6 +92,9 @@
     if (daylightOnOff) {
         return server_gmt_offset + daylightOffset;
     }
+#else
+    if(tm->tm_isdst)
+        return server_gmt_offset + 3600;
 #endif
     return server_gmt_offset;
 #endif
@@ -341,7 +344,6 @@
     struct timeval now;
     time_t t1, t2;
     struct tm t;
-    int was_dst;
 
     gettimeofday(&now, NULL);
     t1 = now.tv_sec;
@@ -352,10 +354,9 @@
 #else
     t = *gmtime(&t1);
 #endif
-    was_dst = (t.tm_isdst > 0);
     t.tm_isdst = -1;
     t2 = mktime(&t);
-    server_gmt_offset = (apr_int32_t) difftime(t1, t2) + (was_dst ? 3600 : 0);
+    server_gmt_offset = (apr_int32_t) difftime(t1, t2);
 #endif
 }
 


On Mon, Jan 07, 2002 at 05:53:18PM -0800, Jon Travis wrote:
> Nope, you're right on that one -- just slap the return in the ifdef
> for netware and commit, I guess.. ;-)
> 
> -- Jon
> 
> On Mon, Jan 07, 2002 at 05:48:06PM -0800, Brian Pane wrote:
> > Jon Travis wrote:
> > 
> > >Ok, here's a small patch which gets things working correctly for me.
> > >Not sure if this patch is correct, though.
> > >
> > 
> > Thanks, I just tested this on Solaris and Linux, and it produced
> > the expected results on both.  The patch logic looks okay, with one
> > possible exception: if NETWARE is defined, do you really want to fall
> > into the "if (tm->tm_isdst)" check if the "if (daylightOnOff)" check
> > fails?  Or should it be:
> > 
> > #ifdef NETWARE
> >     /* Need to adjust the global variable each time otherwise
> >         the web server would have to be restarted when daylight
> >         savings changes.
> >     */
> >     if (daylightOnOff) {
> >         return server_gmt_offset + daylightOffset;
> >     }
> > #else
> >     if(tm->tm_isdst) {
> >         return server_gmt_offset + 3600;
> >     }
> > #endif
> >     return server_gmt_offset;
> > #endif
> > 
> > 

Mime
View raw message