#29205 [Opn->Asn]: NaN in php_sunrise_sunset()
| From: | momo@php.net | Date: | Tue, 21 Sep 2004 06:32:45 +0000 |
| Subject: | #29205 [Opn->Asn]: NaN in php_sunrise_sunset() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-66477@lists.php.net to get a copy of this message | ||
ID: 29205
Updated by: momo@php.net
Reported By: bjdouma at xs4all dot nl
-Status: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: Linux 2.6.7
PHP Version: 5.0.0
-Assigned To:
+Assigned To: momo
New Comment:
date_sunrise(gmmktime(1,1,1,7,21,2004),SUNFUNCS_RET_STRING, 67, 0,
90.83);
returns 03:42 but yes i need to activate the check.
Previous Comments:
------------------------------------------------------------------------
[2004-09-21 08:32:41] momo@php.net
date_sunrise(gmmktime(1,1,1,7,21,2004),SUNFUNCS_RET_STRING, 67, 0,
90.83);
returns 03:42 but yes i need to activate the check.
------------------------------------------------------------------------
[2004-07-16 11:54:17] bjdouma at xs4all dot nl
Description:
------------
Good morning,
Re. php-5.0.0
I noticed in sunfuncs.c/php_sunrise_sunset() there's this commented out
snippet:
/* XXX: What's the use of this block.. ?
* if (!calc_sunset && cosH > 1 || calc_sunset && cosH < -1) {
* throw doesnthappen();
* }
*/
What the 'if' clause actually would detect is cases where you have no
sunrise or sunset, i.e. during the midnight sun period, on the Northern
hemisphere around June 21st, above ca. 66.5 deg latitude.
For instance, try:
php_sunrise_sunset( 182, 66, 0, 90.83, 0 );
this should give a good value for sunrise, very early in the morning.
Now try
php_sunrise_sunset( 182, 67, 0, 90.83, 0 );
this should give NaN.
The reason is obvious: above ca. 66.56 deg latitude in the summer (here
day 182) you have the midnight sun period: the sun doesn't set and/or
rise.
However, this function isn't used anywhere -- is it?
--bjd
bjdouma@xs4all.nl
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29205&edit=1