Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:8497 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84063 invoked by uid 1010); 12 Mar 2004 15:16:46 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 84031 invoked by uid 1007); 12 Mar 2004 15:16:45 -0000 Message-ID: <20040312151645.84026.qmail@pb1.pair.com> To: internals@lists.php.net Date: Fri, 12 Mar 2004 15:16:47 +0000 User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 References: <20040309145620.89319.qmail@pb1.pair.com> In-Reply-To: <20040309145620.89319.qmail@pb1.pair.com> Content-Type: multipart/mixed; boundary="------------040601070408040306020307" X-Posted-By: 80.5.119.206 Subject: Re: gmmktime on windows ends an hour out on the night DST takes affect From: scottmacvicar@ntlworld.com (Scott MacVicar) --------------040601070408040306020307 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Attached is a simply C++ file demonstrating this problem, i suspect that its to do with the fact that the US starts DST at 2am and EU at 1am as for the whole hour 1am - 2am UTC the value of is_dst is 0, i reported this bug to Microsoft today. I've also attached the patch which makes the time for performing mktime to 2:01:01 instead of 01:01:01 and this corrects the issue. Thanks, Scott Scott Macvicar wrote: > Hi, > > I think this is a bug from the depths of Redmond since it takes an hour > off ta->tm_hour but doesn't set ta->tm_isdst, its fairly significant and > can be fixed with a small change. > > If someone with karma could apply the patch in > http://bugs.php.net/bug.php?id=27533 > > Patch basically forces it to make the hour 02:01:01 instead of 01:01:01 > which resolves the isssue. > > Thanks, > Scott --------------040601070408040306020307 Content-Type: text/plain; name="mktime_windows.cpp.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mktime_windows.cpp.txt" #include #include void main(void) { struct tm *ta; time_t t; tzset(); t = time(NULL); ta = localtime(&t); // let mktime find dst ta->tm_isdst = -1; // year ta->tm_year = 104; // month day ta->tm_mday = 28; // week day ta->tm_wday = 0; // month ta->tm_mon = 2; // second ta->tm_sec = 1; //month ta->tm_min = 1; // hour ta->tm_hour = 1; printf("Time Before: %s\n", asctime(ta)); t = mktime(ta); printf("Time After: %s\n", asctime(ta)); printf("Is dst: %i\n", ta->tm_isdst); } --------------040601070408040306020307 Content-Type: text/plain; name="bug27533_patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="bug27533_patch.txt" --- ext/standard/datetime.c 2004-03-09 02:19:32.000000000 +0000 +++ ext/standard/datetime.c.patched 2004-03-09 02:20:48.000000000 +0000 @@ -192,8 +192,8 @@ /* fall-through */ case 1: /* hour */ val = (*arguments[0])->value.lval; - if (val < 1) { - chgsecs += (1-val) * 60*60; val = 1; + if (val < 2) { + chgsecs += (2-val) * 60*60; val = 2; } ta->tm_hour = val; /* fall-through */ --------------040601070408040306020307--