W3C home > Mailing lists > Public > www-lib@w3.org > January to March 1999

Re: Time parsing is wrong?

From: Henrik Frystyk Nielsen <frystyk@w3.org>
Date: Wed, 27 Jan 1999 14:05:22 -0500
To: www-lib@w3.org
Message-ID: <36AF6372.CE08EDAF@w3.org>
To: olga <olga@goliath.eai.com>

olga wrote:

> I have added code to HTTPReq.c to HTTPMakeRequest to get time zone and to print
> the converted timestring:

Try this patch - the trace message was bad because of ctime which takes
timezone into account but that did not have any impact of the one hour
offset. However, it seems that the global variable (at least on solaris)
is 1 right now which surprised me.

I have now changed the code to not use the daylight variable and now I
get the right time on both linux, digital unix, and solaris. However,
there seems to be problems on cygwin but I will check with them.

If it works for you then I can commit it - hopefully it will work on
other platforms as well.

--
Henrik Frystyk Nielsen,
World Wide Web Consortium
http://www.w3.org/People/Frystyk
Index: HTWWWStr.c
===================================================================
RCS file: /sources/public/libwww/Library/src/HTWWWStr.c,v
retrieving revision 2.29
diff -c -r2.29 HTWWWStr.c
*** HTWWWStr.c	1998/12/15 02:54:42	2.29
--- HTWWWStr.c	1999/01/27 19:00:09
***************
*** 429,437 ****
--- 429,442 ----
  	return 0;
      }
  
+ #if 0
  #if defined(HAVE_TIMEZONE) && defined(HAVE_ALTZONE)
      tm.tm_isdst = daylight;		       /* Already taken into account */
+     HTTrace("Time string. Daylight is %s\n",
+ 	    daylight>0 ? "on" : daylight==0 ? "off" : "unknown");
+ #endif
  #else
+     /* Let mktime decide whether we have DST or not */
      tm.tm_isdst = -1;
  #endif
  
***************
*** 446,455 ****
  #endif /* HAVE_TIMEGM */
  #endif /* HAVE_MKTIME */
  
!     if (CORE_TRACE)
! 	HTTrace(
! 		"Time string. %s parsed to %ld seconds, or in local time: %s",
! 		str, (long) t, ctime(&t));
      return t;
  }
  
--- 451,463 ----
  #endif /* HAVE_TIMEGM */
  #endif /* HAVE_MKTIME */
  
!     if (CORE_TRACE) {
! 	char buf[30];
! 	*buf='\0';
! 	HTDateDirStr(&t, buf, 30);
! 	HTTrace("Time string. %s parsed to %ld seconds in local time (%s)\n",
! 		str, (long) t, buf);
!     }    
      return t;
  }
  
Received on Wednesday, 27 January 1999 14:05:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:28 GMT