#38754 [Opn->Bgs]: 1 minute conversion error

From: Date: Fri, 08 Sep 2006 19:48:58 +0000
Subject: #38754 [Opn->Bgs]: 1 minute conversion error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-101891@lists.php.net to get a copy of this message
ID: 38754 Updated by: tony2001@php.net Reported By: mrobertson at hotmail dot com -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Mac OS X 10.4.7 PHP Version: 5.1.6 New Comment: We are happy to tell you that you just discovered Daylight Savings Time. For more information see: http://webexhibits.org/daylightsaving/b.html Instead of using mktime/date consider using gmmktime and gmdate which do not suffer from DST. Previous Comments: ------------------------------------------------------------------------ [2006-09-08 19:44:06] mrobertson at hotmail dot com Description: ------------ There seems to be a 1 minute (3600 second) error in mktime Reproduce code: --------------- $onedayinsecs = 86400; $timeS = mktime(0, 0, 0, 3, 26, 2006); $timeS = $timeS + $onedayinsecs; $dayS = mktime(0, 0, 0, 3, 27, 2006); echo($timeS." - ".$dayS."<br/>"); Expected result: ---------------- The two values should be the same since we are adding 1 day in seconds to mktime value of 3/26/06 and getting the mktime value of 3/27/06. Actual result: -------------- 1143417600 - 1143414000 The difference is 3600. Note if you start at 1/1/06 and go through all the days in the year totalling seconds in comparison to mktime this error exists between 3/27/06 and 10/29/06. From 30/10/06 the error corrects itself. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38754&edit=1

« previous php.bugs (#101891) next »