]> granicus.if.org Git - php/commitdiff
Fix #65547: Default value for sunrise/sunset zenith still wrong
authorChristoph M. Becker <cmbecker69@gmx.de>
Mon, 15 Jul 2019 08:41:00 +0000 (10:41 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 15 Jul 2019 11:52:09 +0000 (13:52 +0200)
The value of the zenith angle to calculate sunrise and sunset times is
commonly defined as 90°50', and is "obtained by adding the average
apparent radius of the Sun (16') to the average amount of atmospheric
refraction at the horizon (34')", according to
http://aa.usno.navy.mil/faq/docs/RST_defs.php.

This value is also used for the Sunrise/Sunset Algorithm published in
the Almanac for Computers, 1990, see
https://web.archive.org/web/20161202180207/http://williams.best.vwh.net/sunrise_sunset_algorithm.htm.

NEWS
ext/date/php_date.c
ext/date/tests/date_sun_info_001.phpt
ext/date/tests/date_sun_info_002.phpt
php.ini-development
php.ini-production

diff --git a/NEWS b/NEWS
index 5c0a2c8369954ce5cec61643f13a516f8cc05e93..fd429440278d1c1026b0384f1cb4176a79db7082 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,8 +8,9 @@ PHP                                                                        NEWS
     (Fabien Villepinte)
 
 - Date:
-  . Fixed #69044 (discrepency between time and microtime). (krakjoe)
-
+  . Fixed bug #65547 (Default value for sunrise/sunset zenith still wrong).
+    (cmb)
+  . Fixed bug #69044 (discrepency between time and microtime). (krakjoe)
 - GD:
   . Removed deprecated image2wbmp(). (cmb)
   . Removed deprecated png2wbmp() and jpeg2wbmp(). (cmb)
index ab74173f08c659d6cadc0c6bfc97d1fa59500276..87d5ac7f6eccd1f408ffe4cd2081174b7801ed7d 100644 (file)
@@ -581,11 +581,11 @@ int php_date_global_timezone_db_enabled;
 #define DATE_DEFAULT_LATITUDE "31.7667"
 #define DATE_DEFAULT_LONGITUDE "35.2333"
 
-/* on 90'35; common sunset declaration (start of sun body appear) */
-#define DATE_SUNSET_ZENITH "90.583333"
+/* on 90'50; common sunset declaration (start of sun body appear) */
+#define DATE_SUNSET_ZENITH "90.833333"
 
-/* on 90'35; common sunrise declaration (sun body disappeared) */
-#define DATE_SUNRISE_ZENITH "90.583333"
+/* on 90'50; common sunrise declaration (sun body disappeared) */
+#define DATE_SUNRISE_ZENITH "90.833333"
 
 static PHP_INI_MH(OnUpdate_date_timezone);
 
@@ -5013,7 +5013,7 @@ PHP_FUNCTION(date_sun_info)
        array_init(return_value);
 
        /* Get sun up/down and transit */
-       rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -35.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
+       rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -50.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
        switch (rs) {
                case -1: /* always below */
                        add_assoc_bool(return_value, "sunrise", 0);
index c9096af46d4b1cbdde6bd08c7303425fb5107430..708d2550ccac5f3772d78562007f213ab71da14e 100644 (file)
@@ -10,9 +10,9 @@ echo "Done\n";
 --EXPECT--
 array(9) {
   ["sunrise"]=>
-  int(1165897761)
+  int(1165897682)
   ["sunset"]=>
-  int(1165934160)
+  int(1165934239)
   ["transit"]=>
   int(1165915961)
   ["civil_twilight_begin"]=>
index 73956cc46a8d7e43b1bdf79be43e78971d5f4574..f74f1c88def0e8c9d8defab62e55fa45b2f40a3a 100644 (file)
@@ -11,8 +11,8 @@ foreach ($sun_info as $key => $elem )
 echo "Done\n";
 ?>
 --EXPECT--
-2007-04-13 06:13:31 CEST sunrise
-2007-04-13 20:30:51 CEST sunset
+2007-04-13 06:11:26 CEST sunrise
+2007-04-13 20:32:56 CEST sunset
 2007-04-13 13:22:11 CEST transit
 2007-04-13 05:29:22 CEST civil_twilight_begin
 2007-04-13 21:15:00 CEST civil_twilight_end
index 6965fe3b952afd22c2ac04d3ead0059bc61c70ee..9f3b153a89a30b4b79dbfdf122f90c5aaba9afdd 100644 (file)
@@ -947,10 +947,10 @@ cli_server.color = On
 ;date.default_longitude = 35.2333
 
 ; http://php.net/date.sunrise-zenith
-;date.sunrise_zenith = 90.583333
+;date.sunrise_zenith = 90.833333
 
 ; http://php.net/date.sunset-zenith
-;date.sunset_zenith = 90.583333
+;date.sunset_zenith = 90.833333
 
 [filter]
 ; http://php.net/filter.default
index 25f7bf066d84c52fb63c85df6afb9419c4b17e96..12807f8b6df4506db011411caedf4c5659016309 100644 (file)
@@ -949,10 +949,10 @@ cli_server.color = On
 ;date.default_longitude = 35.2333
 
 ; http://php.net/date.sunrise-zenith
-;date.sunrise_zenith = 90.583333
+;date.sunrise_zenith = 90.833333
 
 ; http://php.net/date.sunset-zenith
-;date.sunset_zenith = 90.583333
+;date.sunset_zenith = 90.833333
 
 [filter]
 ; http://php.net/filter.default