Bugs item #1230118, was opened at 2005-06-30 05:27
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1230118&group_id=976
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: libcurl
Group: wrong behaviour
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
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 seconds
----------------------------------------------------------------------
>Comment By: Daniel Stenberg (bagder)
Date: 2005-06-30 08:12
Message:
Logged In: YES
user_id=1110
I'm puzzled.
Why is "automatic DST adjustment" ? Isn't that the thing
that automatically changes to DST at one date and then at
another later date it again switches off DST?
If so, how on earth can that affect the date functions like
this?
libcurl is simply using mktime() and gmtime(). I don't see
how that can be wrong. To me, it looks like Windows or the c
library you're using, is doing it wrong.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1230118&group_id=976
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-tracker
Received on 2005-06-30