ID:               49558
 Comment by:       colin at viebrock dot ca
 Reported By:      eclipsechasers2 at yahoo dot com
 Status:           Open
 Bug Type:         Date/time related
 Operating System: *
 PHP Version:      5.2.10
 New Comment:

TYPO IN LAST COMMENT - SHOULD READ:

Altitude is 90-zenith, so when you are below 91, the code sets that 
param to 0 ... which I think means it calculates the twilight 
time instead of sunrise/set.  I would say this param should always be 1

if you are calculating sunrise/set (see note on line 187 of 
ext/date/lib/astro.c).


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

[2009-09-15 17:18:18] colin at viebrock dot ca

I'd say that all the times from 91 degrees onward are off.  Graphing
the 
data shows it "jumps" at that point, but is smooth before and after.

Could it be some error related to line 3930 in ext/date/php_date.c

rs = timelib_astro_rise_set_altitude(t, longitude, latitude, altitude,

altitude > -1 ? 1 : 0, &h_rise, &h_set, &rise, &set, &transit);

Altitude is 90-zenith, so when you get to 91, the code would set that 
param from 0 to 1 ... which I think means it calculates the twilight 
time instead of sunrise/set.  I would say this param should always be
1, 
if you are calculating sunrise/set (see note on line 187 of 
ext/date/lib/astro.c).

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

[2009-09-15 05:51:13] 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


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


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

Reply via email to