curl-library
[ curl-Bugs-1230118 ] curl_getdate(), DST, and cookie expiration (fwd)
From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 4 Jul 2005 23:13:20 +0200 (CEST)
Date: Mon, 4 Jul 2005 23:13:20 +0200 (CEST)
Hi friends
We got this bug report on curl_getdate() on Windows, and I need some help with
testing and fixing/working around this problem.
There are some further details and comments in the actual bug tracker entry...
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.html ---------- Forwarded message ---------- Bugs item #1230118, was opened at 2005-06-30 05:27 https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1230118&group_id=976 Summary: curl_getdate(), DST, and cookie expiration Initial Comment: Platform: Windows XP libcurl: 7.14 With the system clock properly configured to automatically adjust for Daylight Saving Time, curl_getdate() appears to return a time_t value which is 1 hour ahead of the correct value. This prevents cookies from expiring at the proper time. The following demonstrates the problem: #include <stdio.h> #include "curl/curl.h" int main() { time_t tNow = ::time(NULL); tm tmGMT; char szGMT[128]; ::memcpy(&tmGMT, ::gmtime(&tNow), sizeof(tm)); ::strftime( szGMT, 128, "%a, %d-%b-%Y %H:%M:%S GMT", &tmGMT ); time_t tCURL = ::curl_getdate(szGMT, NULL); time_t tDiff = tCURL - tNow; printf("Current time: %s\n", szGMT); printf("Sytem time_t: %i\n", tNow); printf("libcurl time_t: %i\n", tCURL); printf("Difference: %i seconds\n", tCURL - tNow); return 0; } ----------------------------------------------------------- Example run with properly configured system clock (during DST): Current time: Thu, 30-Jun-2005 03:02:14 GMT Sytem time_t: 1120100534 libcurl time_t: 1120104134 Difference: 3600 seconds ----------------------------------------------------------- Example run with automatic DST adjustment disabled: Current time: Thu, 30-Jun-2005 03:02:28 GMT Sytem time_t: 1120100548 libcurl time_t: 1120100548 Difference: 0 secondsReceived on 2005-07-04