From 265e2df10ce5cdede19f93ae434d03b0abf903c0 Mon Sep 17 00:00:00 2001 From: leitner Date: Mon, 4 Apr 2005 10:14:11 +0000 Subject: [PATCH] make sure scan_httpdate uses GMT for mktime --- scan/scan_httpdate.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scan/scan_httpdate.c b/scan/scan_httpdate.c index 4ead698..9a7abd9 100644 --- a/scan/scan_httpdate.c +++ b/scan/scan_httpdate.c @@ -1,7 +1,9 @@ #include "scan.h" #include "byte.h" #include "case.h" +#define _GNU_SOURCE #include +#include static int parsetime(const char*c,struct tm* x) { unsigned long tmp; @@ -54,6 +56,15 @@ unsigned int scan_httpdate(const char *in,time_t *t) { if (byte_equal(c,3,"GMT")) c+=3; done: x.tm_wday=x.tm_yday=x.tm_isdst=0; - *t=mktime(&x); +#if defined(__dietlibc__) || defined(__GLIBC__) + *t=timegm(&x); +#else + { + char* old=getenv("TZ"); + unsetenv("TZ"); + *t=mktime(&x); + if (old) setenv("TZ",old,1); + } +#endif return c-in; }