aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-07-05 14:57:41 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-07-05 14:57:41 +0000
commitd49c1442970642ba0daf2654b54dca971c83fd8c (patch)
treeeb1de9c62dd4f5709dc2f741b03b9682e0dc6cb6 /lib
parente7de7d5eb32a9cade77f39eeb2f6386527cb02d6 (diff)
Gisle Vanem came up with a nice little work-around for bug #1230118. It
seems the Windows (MSVC) libc time functions may return data one hour off if TZ is not set and automatic DST adjustment is enabled. This made curl_getdate() return wrong value, and it also concerned internal cookie expirations etc.
Diffstat (limited to 'lib')
-rw-r--r--lib/parsedate.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/parsedate.c b/lib/parsedate.c
index 52529848d..ae9e232a9 100644
--- a/lib/parsedate.c
+++ b/lib/parsedate.c
@@ -236,9 +236,20 @@ static time_t Curl_parsedate(const char *date)
struct tm tm;
enum assume dignext = DATE_MDAY;
const char *indate = date; /* save the original pointer */
-
int part = 0; /* max 6 parts */
+#ifdef WIN32
+ /*
+ * On Windows, we need an odd work-around for the case when no TZ variable
+ * is set. If it isn't set and "automatic DST adjustment" is enabled, the
+ * time functions below will return values one hour off! As reported and
+ * investigated in bug report #1230118.
+ */
+ const char *env = getenv("TZ");
+ if(!env)
+ putenv("TZ=GMT");
+#endif
+
while(*date && (part < 6)) {
bool found=FALSE;