RE: [PHP-DEV] PHP 4.0 Bug #7038: mktime returns incorrect values for some years
| From: | Mike Berry-Porter | Date: | Wed, 04 Oct 2000 23:42:20 +0000 |
| Subject: | RE: [PHP-DEV] PHP 4.0 Bug #7038: mktime returns incorrect values for some years | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-34268@lists.php.net to get a copy of this message | ||
Could this not just be your region's day-light saving time for those years?
The difference you've shown is 3600 seconds, or 60 minutes, or 1 hour
(typical daylight saving duration). This is picked up by the OS you are
using. If you don't want daylight savings time to kick in, then try using
gmmktime, which uses GMT dates (which DON'T use DST).
MBP
mikebp@alverstone.com.au
-----Original Message-----
From: jkakar@nisa.net [mailto:jkakar@nisa.net]
Sent: Thursday, 5 October 2000 7:15 PM
To: php-dev@lists.php.net
Subject: [PHP-DEV] PHP 4.0 Bug #7038: mktime returns incorrect values
for some years
From: jkakar@nisa.net
Operating system: RedHat Linux 7.0
PHP version: 4.0.3RC2
PHP Bug Type: Date/time related
Bug description: mktime returns incorrect values for some years
mktime() should return 86400 (the number of seconds in a
day) for the following calculations. For some years (1972,
1978, 1989, 1995, 2000, etc.) it returns 90000 instead of
86400. The following code will demonstrate this.
<?php
function
mktime_test ()
{
for ($i = 0; $i < 100; ++$i)
{
/* $timestamp should = 86400. (ie: 60 x 60 x 24). */
$timestamp = mktime (0,0,0,10,30,$i) - mktime
(0,0,0,10,29,$i);
if ($i < 10)
{
$year = "200" . $i;
}
else if ($i < 70)
{
$year = "20" . $i;
}
else
{
$year = "19" . $i;
}
printf ("
$year - $timestamp<br>
");
}
}
mktime_test ();
?>
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
For additional commands, e-mail: php-dev-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net