php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31853 date_sunrise/date_sunset timestamp calculation bug
Submitted: 2005-02-05 17:24 UTC Modified: 2005-02-10 15:36 UTC
From: php-bugs at demark dot org Assigned: pajoye (profile)
Status: Closed Package: Date/time related
PHP Version: 5.0.3 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php-bugs at demark dot org
New email:
PHP Version: OS:

 

 [2005-02-05 17:24 UTC] 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-10 15:36 UTC] pajoye@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC