ID:               32820
 Updated by:       [EMAIL PROTECTED]
 Reported By:      matt-dated-1114405650 dot e8a5a2 at codewalkers
-Status:           Assigned
+Status:           Closed
 Bug Type:         Date/time related
 Operating System: *
 PHP Version:      5CVS-2005-04-25 (dev)
 Assigned To:      derick
 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.

Fixed for 5.1.2 and later


Previous Comments:
------------------------------------------------------------------------

[2005-10-09 00:04:18] filcab at gmail dot com

You should only need to do:

ret = php_sunrise_sunset(N, latitude, longitude, zenith, calc_sunset) +
(gmt_offset + 24) % 24;

That should do it (no if's :D)... I can't checkout the source and patch
it ATM.



Filipe Cabecinhas.

------------------------------------------------------------------------

[2005-04-25 06:35:14] matt-dated-1114405650 dot e8a5a2 at codewalkers

Sorry...

"There seems to be a bug in date_sunrise and date_sunset when the GMT
offset is greater than the sunrise or sunset time."

should have read:

"There seems to be a bug in date_sunrise and date_sunset when the GMT
offset is negative and the absolute value is greater than the sunrise
or sunset time."

------------------------------------------------------------------------

[2005-04-25 06:24:03] matt-dated-1114405650 dot e8a5a2 at codewalkers

Description:
------------
There seems to be a bug in date_sunrise and date_sunset when the GMT
offset is greater than the sunrise or sunset time.

For instance, if the date_sunset function returns '00:14' as the sunset
time in GMT, trying to use the GMT offset of -4 would result in '-3:-4'
being returned.

In sunfuncs.c there is a line:

ret = php_sunrise_sunset(N, latitude, longitude, zenith, calc_sunset) +
gmt_offset;

It seems that it should check if gmt_offset is greater than the
returned value from php_sunrise_sunset and if so, add 24 to the
returned value before the addition of gmt_offset.


Reproduce code:
---------------
<?php
echo date("D M d Y"). ', sunset time : ' .date_sunset(time(),
SUNFUNCS_RET_STRING, 40, -83, 90, -4);
?>


Expected result:
----------------
I would expect to see:

Sun Apr 24 2005, sunset time : 20:14


Actual result:
--------------
I actually see:

Sun Apr 24 2005, sunset time : -3:-4


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32820&edit=1

Reply via email to