From: andreas dot braun at netcologne dot de
Operating system: Win XP Pro / Suse 9.1
PHP version: 5.2.1
PHP Bug Type: Date/time related
Bug description: Incorrect GMT timestamp
Description:
------------
REFERS TO THE FOLLOWING PHP VERSIONS:
Windows: 4.3.8 Linux: 4.3.8
4.4.4
5.0.0
5.1.6
5.2.1
1. My Wndows PC uses as local time CET (GMT+01:00 Amsterdam, Berlin, Bern
Rome ....) for Germany and my Linux PC uses CET too.
So if we have 09:11:08(CET) GMT is 08:11:08. But gmmktime() returns under
PHP 4.3.8, 4.4.4 and 5.0.0 a timestamp for 10:11:08. That's wrong!
With 5.1.6 and 5.2.1 gmmktime() returns the same value as mktime() and
dsttime is now 1 instead of 0.
That's wrong, too!
Reproduce code:
---------------
<?php
echo time();
echo "\n";
$var1 = gmmktime();
echo "GMT:\t $var1";
echo "\n";
$var2 = mktime();
echo "Local:\t $var2";
echo "\n";
$gmdate = date("d.m.Y - H:i:s", $var1);
$localdate = date("d.m.Y - H:i:s", $var2);
echo "GMT-Time: $gmdate\n";
echo "Local-Time: $localdate";
echo "\n";
print_r(gettimeofday());
?>
Actual result:
--------------
***********************************************************
UNDER WIN XP with CET(GMT+01) as local time AND PHP 5.0.0
C:\Inetpub\wwwroot\cacti>php-cgi -v
PHP 5.0.0 (cgi-fcgi) (built: Jul 13 2004 21:39:41)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.0, Copyright (c) 1998-2004 Zend Technologies
C:\Inetpub\wwwroot\cacti>php-cgi date.php
Content-type: text/html
X-Powered-By: PHP/5.0.0
1171234727
GMT: 1171238327 ****** <- THIS IS WRONG!
Local: 1171234727
GMT-Time: 12.02.2007 - 00:58:47
Local-Time: 11.02.2007 - 23:58:47
Array
(
[sec] => 1171234727 ****** <- THIS IS CORRECT!
[usec] => 126785 ****** <- THIS IS CORRECT!
[minuteswest] => -60 ****** <- THIS IS CORRECT!
[dsttime] => 1
)
C:\Inetpub\wwwroot\cacti>
***********************************************************
***********************************************************
UNDER WIN XP with CET(GMT+01) as local time AND PHP 5.2.1
C:\Inetpub\wwwroot\cacti>php -v
PHP 5.2.1 (cli) (built: Feb 7 2007 23:11:26)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
C:\Inetpub\wwwroot\cacti>php date.php
1171235055
GMT: 1171235055 ****** <- THIS IS WRONG!
Local: 1171235055
GMT-Time: 12.02.2007 - 00:04:15
Local-Time: 12.02.2007 - 00:04:15
Array
(
[sec] => 1171235055 ****** <- THIS IS CORRECT!
[usec] => 524359 ****** <- THIS IS CORRECT!
[minuteswest] => -60 ****** <- THIS IS CORRECT!
[dsttime] => 0
)
C:\Inetpub\wwwroot\cacti>
***********************************************************
***********************************************************
UNDER SUSE 9.1 with CET(GMT+01) as local time AND PHP 4.3.8
dev3:/thishost/unix/cen/cacti/plugins # php date.php
1171267868
GMT: 1171271468 ****** <- THIS IS WRONG!
Local: 1171267868
GMT-Time: 12.02.2007 - 10:11:08
Local-Time: 12.02.2007 - 09:11:08
Array
(
[sec] => 1171267868 ****** <- THIS IS CORRECT!
[usec] => 455367 ****** <- THIS IS CORRECT!
[minuteswest] => -60 ****** <- THIS IS CORRECT!
[dsttime] => 0
)
dev3:/thishost/unix/cen/cacti/plugins # date
Mon Feb 12 09:11:13 CET 2007
***********************************************************
SO, THE RESULT IS WRONG GMT-TIME HAS TO BE 08:11:08 RESPECTIVELY
1171264268
***********************************************************
--
Edit bug report at http://bugs.php.net/?id=40444&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=40444&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=40444&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=40444&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40444&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=40444&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40444&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40444&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40444&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40444&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40444&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=40444&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=40444&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40444&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40444&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40444&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40444&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40444&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40444&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40444&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40444&r=mysqlcfg