#31853 [Opn->Csd]: date_sunrise/date_sunset timestamp calculation bug
| From: | pajoye@php.net | Date: | Thu, 10 Feb 2005 14:36:07 +0000 |
| Subject: | #31853 [Opn->Csd]: date_sunrise/date_sunset timestamp calculation bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-73761@lists.php.net to get a copy of this message | ||
ID: 31853
Updated by: pajoye@php.net
Reported By: php-bugs at demark dot org
-Status: Open
+Status: Closed
Bug Type: Date/time related
Operating System: Linux
PHP Version: 5.0.3
-Assigned To:
+Assigned To: pajoye
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2005-02-05 17:24:03] php-bugs at demark dot org
Description:
------------
Line 207 of ext/standard/sunfuncs.c is:
RETURN_LONG((int) (time - (time % (24 * 3600))) + (int)
(60 * ret));
since 'ret' is a double representing the number of hours
since midnight the sun event occurred and 'time' is in
seconds, the last multiplier should be number of
seconds in an hour, not number of minutes in a hour:
RETURN_LONG((int) (time - (time % (24 * 3600))) + (int)
(3600 * ret));
or, if you want to save one arithmetic step:
RETURN_LONG((int) (time - (time % 86400)) + (int)
(3600 * ret));
This is also the cause of Bug #30745.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31853&edit=1