PHP 4.0 Bug #7038 Updated: mktime returns incorrect values for some years
| From: | Bug Database | Date: | Fri, 06 Oct 2000 01:54:00 +0000 |
| Subject: | PHP 4.0 Bug #7038 Updated: mktime returns incorrect values for some years | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-34313@lists.php.net to get a copy of this message | ||
ID: 7038
Updated by: stas
Reported By: jkakar@nisa.net
Status: Closed
Bug Type: Date/time related
Assigned To:
Comments:
Not every day is 86400 seconds. Due to timezone changes, some days can be 1 hour longer or shorter
(or, more precisely, distance between certain minutes on the edge of DST can be 1 hour more or less
than usual).
Previous Comments:
---------------------------------------------------------------------------
[2000-10-05 07:15:28] jkakar@nisa.net
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 ();
?>
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7038