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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Apr 25 13:01:30 2024 UTC