|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-09-15 05:51 UTC] eclipsechasers2 at yahoo dot com
Description:
------------
Script showing times for series of zeniths from 90.0 to 92.0 by 0.1 should show time uniformly decreasing (earlier) as zenith gets larger. This is true for most values. However, 91.1 shows a later time than 91.0, as does 91.2; this would happen only if earth changed its direction of rotation.
Reproduce code:
---------------
<?php
$gregyear = 2009; $gregmonth = 3; $gregday = 20;
$location = "San Francisco"; $latitude = 37.787; $longitude = -122.447;
$timezone = "America/Los_Angeles";
$gregmonthname = JDMonthName(cal_to_jd(CAL_GREGORIAN,$gregmonth,1,2000),1);
$jd = gregoriantojd($gregmonth, $gregday, $gregyear);
$weekday = jddayofweek($jd,0);
echo "<b>$gregyear $gregmonthname $dd - " . jddayofweek($jd,1) . " - ";
echo "Latitude $latitude Longitude $longitude Time Zone $timezone Location $location</b>\n";
$ts = $gregyear . "-" . $gregmonth . "-" . $dd . " 06:00:00";
$strts = strtotime($ts);
$gmto = -8;
for ($deg = 90; $deg <= 92; $deg += .1) {
$sunris0 = date_sunrise($strts,SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $deg, $gmto);
printf("<br>%02.1f %s\n",$deg,date("g:i:sa",$sunris0));
}
?>
Expected result:
----------------
Unsure of exact result (can't do these calculations in my head), but the times on each line should be earlier than the line above.
Actual result:
--------------
2009 March - Friday - Latitude 37.787 Longitude -122.447 Time Zone America/Los_Angeles Location San Francisco
90.0 7:28:40am
90.1 7:28:05am
90.2 7:27:30am
90.3 7:26:56am
90.4 7:26:21am
90.5 7:25:46am
90.6 7:25:11am
90.7 7:24:37am
90.8 7:24:02am
90.9 7:23:28am
91.0 7:22:53am
91.1 7:23:52am ** Either these 2 values, or the 2 above, are wrong.
91.2 7:23:18am
91.3 7:22:43am
91.4 7:22:08am
91.5 7:21:34am
91.6 7:20:59am
91.7 7:20:25am
91.8 7:19:51am
91.9 7:19:16am
92.0 7:18:42am
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 15:00:02 2025 UTC |
i think the bug is being caused by this altitude > -1 ? 1:0 ,line 3930 in php_date.c. becoz of this upper_limb correction is being applied here.... if (upper_limb) {altit -= sradius;} line 253, astro.c the series gets advanced because of the altit-=sradius;. and hence the anamoly. i dont knw if its a bug. don't know about the upper limb correction and why is it being selectively beyond -1 applied. but the bug can be removed if we remove the uppr_limb if code. or add it without an if. and if the correction is correctly applied, then i guess thats the way it is.not a bug.