#27719 [Csd->Fbk]: mktime returns incorrect timestamp for dst days
| From: | nohn@php.net | Date: | Sat, 08 Oct 2005 09:16:27 +0000 |
| Subject: | #27719 [Csd->Fbk]: mktime returns incorrect timestamp for dst days | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-86238@lists.php.net to get a copy of this message | ||
ID: 27719
Updated by: nohn@php.net
Reported By: schmidt dot a at rogers dot com
-Status: Closed
+Status: Feedback
Bug Type: Date/time related
Operating System: FreeBSD 4.4
-PHP Version: 5.0.0RC1
+PHP Version: 4.4.1RC1, 5.0.0RC1
-Assigned To:
+Assigned To: derick
New Comment:
With PHP 4.4.1RC1 i get these results when running the test:
echo mktime(0, 0, 0, 4, 4, 2004, 0) . "\n";
echo mktime(0, 0, 0, 4, 4, 2004, 1) . "\n";
echo mktime(0, 0, 0, 4, 4, 2004, -1) . "\n";
1081033200
1081029600
1081029600
Derick, is that expected behaviour?
Previous Comments:
------------------------------------------------------------------------
[2004-03-30 07:42:52] derick@php.net
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2004-03-26 14:50:12] schmidt dot a at rogers dot com
problem fixed. thanks.
------------------------------------------------------------------------
[2004-03-26 14:25:25] rasmus@php.net
I have committed a fix which uses the 4am offset instead of 2 there
around line 192 in datetime.c. Any chance you could test that and let
me know if it fixes your problem?
------------------------------------------------------------------------
[2004-03-26 14:00:40] rasmus@php.net
I made the changed referenced above to address this bug:
http://bugs.php.net/27533
Perhaps the solution here is to offset it to +3 or +4 instead to get
the baseline timestamp.
------------------------------------------------------------------------
[2004-03-26 13:39:51] schmidt dot a at rogers dot com
Ok I've done some more testing, FreeBSD mktime will return -1 when
passed in 2 am for the day when clocks are being moved ahead, since
2am should never exist.
I'm not sure how linux handles this (maybe returns a 3am timestamp).
This coupled with the change to ext/standard/datetime.c line 192+ which
always changes the hour 2am if its 12 or 1 am. Unfortunatly this has a
bad effect of messing up 12am and 1am for daylight savings days which
are valid hours.
http://cvs.php.net/diff.php/php-src/ext/standard/datetime.c?r1=1.116&r2=1.117&ty=h
I'm not sure what the best solution is, but I hope this helps.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/27719
--
Edit this bug report at http://bugs.php.net/?id=27719&edit=1