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
#include <time.h> #include <stdio.h>
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); }
--- 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 */
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php