cURL / Mailing Lists / curl-library / Single Mail

curl-library

Bug 1230118: patch for curl_getdate() for win32

From: Dov Murik <dov.murik_at_gmail.com>
Date: Tue, 9 May 2006 18:09:20 +0300

Dear curl developers,

The problem with MSVCRT (Microsoft's libc) regarding the unexplained
DST fix it applies to timestamps within April and October when the TZ
environment variable is not set (yes, it's crazy, I know) was
discussed here:

http://curl.haxx.se/mail/lib-2005-07/0025.html

and here:

https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1230118&group_id=976

1. russ777's last comment on sourceforge was not incorporated into
curl. So I changed putenv to _putenv.
2. I found that setting TZ with _putenv did not suffice (at least in
MSVC6, I didn't test on other versions); I must explicitly call
_tzset() to make the runtime library reread TZ's value.

The patch I propose for parsedate.c solves this problem (compiled and
tested on MSVC6).

Thanks a lot,
Dov Murik.

Patch follows:

--- curl-7.15.4-20060509/lib/parsedate.c 2005-12-30
03:00:10.000000000 +0000
+++ my_curl/lib/parsedate.c 2006-05-09 14:50:13.000000000 +0000
@@ -247,8 +247,10 @@
    * investigated in bug report #1230118.
   */
   const char *env = getenv("TZ");
- if(!env)
- putenv("TZ=GMT");
+ if(!env) {
+ _putenv("TZ=GMT");
+ _tzset();
+ }
  #endif

   while(*date && (part < 6)) {
Received on 2006-05-09