diff options
author | Derick Rethans <derick@php.net> | 2007-04-13 08:33:48 +0000 |
---|---|---|
committer | Derick Rethans <derick@php.net> | 2007-04-13 08:33:48 +0000 |
commit | 2e18eb385803d6af06b35562f4129ffd0d7c279b (patch) | |
tree | ed86b4e07a8638e83ab1505ee2ad1631a6404cf1 | |
parent | d62dca3d48324206a3c21d2cc6f43d68b01d66f1 (diff) | |
download | php-git-2e18eb385803d6af06b35562f4129ffd0d7c279b.tar.gz |
- Fixed bug #39965 (Latitude and longitude are backwards in date_sun_info()).
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/date/php_date.c | 8 | ||||
-rw-r--r-- | ext/date/tests/date_sun_info_001.phpt | 18 | ||||
-rw-r--r-- | ext/date/tests/date_sun_info_002.phpt | 24 |
4 files changed, 39 insertions, 13 deletions
@@ -10,6 +10,8 @@ PHP NEWS units correctly). (Derick) - Fixed bug #40290 (strtotime() returns unexpected result with particular timezone offset). (Derick) +- Fixed bug #39965 (Latitude and longitude are backwards in date_sun_info()). + (Derick) 10 Apr 2007, PHP 5.2.2RC1 diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 03ae867e0c..ea896b6f87 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2387,7 +2387,7 @@ PHP_FUNCTION(date_sun_info) array_init(return_value); /* Get sun up/down and transit */ - rs = timelib_astro_rise_set_altitude(t, latitude, longitude, -35.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit); + rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -35.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit); switch (rs) { case -1: /* always below */ add_assoc_bool(return_value, "sunrise", 0); @@ -2407,7 +2407,7 @@ PHP_FUNCTION(date_sun_info) add_assoc_long(return_value, "transit", timelib_date_to_int(t2, &dummy)); /* Get civil twilight */ - rs = timelib_astro_rise_set_altitude(t, latitude, longitude, -6.0, 0, &ddummy, &ddummy, &rise, &set, &transit); + rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -6.0, 0, &ddummy, &ddummy, &rise, &set, &transit); switch (rs) { case -1: /* always below */ add_assoc_bool(return_value, "civil_twilight_begin", 0); @@ -2425,7 +2425,7 @@ PHP_FUNCTION(date_sun_info) } /* Get nautical twilight */ - rs = timelib_astro_rise_set_altitude(t, latitude, longitude, -12.0, 0, &ddummy, &ddummy, &rise, &set, &transit); + rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -12.0, 0, &ddummy, &ddummy, &rise, &set, &transit); switch (rs) { case -1: /* always below */ add_assoc_bool(return_value, "nautical_twilight_begin", 0); @@ -2443,7 +2443,7 @@ PHP_FUNCTION(date_sun_info) } /* Get astronomical twilight */ - rs = timelib_astro_rise_set_altitude(t, latitude, longitude, -18.0, 0, &ddummy, &ddummy, &rise, &set, &transit); + rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -18.0, 0, &ddummy, &ddummy, &rise, &set, &transit); switch (rs) { case -1: /* always below */ add_assoc_bool(return_value, "astronomical_twilight_begin", 0); diff --git a/ext/date/tests/date_sun_info_001.phpt b/ext/date/tests/date_sun_info_001.phpt index 7ab4af5981..d469e37e7e 100644 --- a/ext/date/tests/date_sun_info_001.phpt +++ b/ext/date/tests/date_sun_info_001.phpt @@ -11,22 +11,22 @@ echo "Done\n"; --EXPECTF-- array(9) { ["sunrise"]=> - int(1165899133) + int(1165897782) ["sunset"]=> - int(1165934481) + int(1165934168) ["transit"]=> - int(1165916807) + int(1165915975) ["civil_twilight_begin"]=> - int(1165897449) + int(1165896176) ["civil_twilight_end"]=> - int(1165936165) + int(1165935773) ["nautical_twilight_begin"]=> - int(1165895547) + int(1165894353) ["nautical_twilight_end"]=> - int(1165938067) + int(1165937597) ["astronomical_twilight_begin"]=> - int(1165893693) + int(1165892570) ["astronomical_twilight_end"]=> - int(1165939921) + int(1165939380) } Done diff --git a/ext/date/tests/date_sun_info_002.phpt b/ext/date/tests/date_sun_info_002.phpt new file mode 100644 index 0000000000..b41d123d97 --- /dev/null +++ b/ext/date/tests/date_sun_info_002.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test basic date_sun_info() +--INI-- +date.timezone=Europe/Oslo +--FILE-- +<?php +$sun_info = date_sun_info(strtotime("2007-04-13 08:31:15 UTC"), 59.21, 9.61); +foreach ($sun_info as $key => $elem ) +{ + echo date( 'Y-m-d H:i:s T', $elem ), " ", $key, "\n"; +} +echo "Done\n"; +?> +--EXPECTF-- +2007-04-13 06:12:19 CEST sunrise +2007-04-13 20:31:50 CEST sunset +2007-04-13 13:22:05 CEST transit +2007-04-13 05:28:03 CEST civil_twilight_begin +2007-04-13 21:16:06 CEST civil_twilight_end +2007-04-13 04:30:08 CEST nautical_twilight_begin +2007-04-13 22:14:01 CEST nautical_twilight_end +2007-04-13 03:14:36 CEST astronomical_twilight_begin +2007-04-13 23:29:33 CEST astronomical_twilight_end +Done |