ID:               40444
 Updated by:       [EMAIL PROTECTED]
 Reported By:      andreas dot braun at netcologne dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         Date/time related
 Operating System: Win XP Pro / Suse 9.1
 PHP Version:      5.2.1
 New Comment:

Set correct timezone using date.timezone.
More details:
http://www.php.net/manual/en/function.date-default-timezone-set.php


Previous Comments:
------------------------------------------------------------------------

[2007-02-12 10:03:31] andreas dot braun at netcologne dot de

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 this bug report at http://bugs.php.net/?id=40444&edit=1

Reply via email to