#33671 [NEW]: sun_rise and sun_set don't return a GMT timestamp if one passes an offset

From: Date: Tue, 12 Jul 2005 22:53:08 +0000
Subject: #33671 [NEW]: sun_rise and sun_set don't return a GMT timestamp if one passes an offset
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-81777@lists.php.net to get a copy of this message
From: golf at dds dot nl Operating system: Linux Debian PHP version: 5.0.4 PHP Bug Type: Date/time related Bug description: sun_rise and sun_set don't return a GMT timestamp if one passes an offset Description: ------------ With my current version of PHP5 (5.0.4-0.6.sarge.1 (Debian GNU/Linux) I run into an error if I use date_sunrise and date_sunset. This happens when I pass an GMT offset and results in a timestamp that has an offset of +1 hour to the actual sun set/rise on that date. Since timestamps are GMT/UTC and not bound to an timezone other that GMT/UTC this is wrong. I say this since I believe the GMT offset one can pass to the before mentioned functions is used in the calculation and the functions should return a timestamp like any other so it can be used by date and gmdate as those functions require a GMT/UTC timestamp... B.t.w. I use the max difference for some further calculations in my script, so there for the lage difference between astro and official sunset's/rises... Reproduce code: --------------- $latitude = 28 + (1/60*17) + (1/60/60*54); $longitude = (-(16 + (1/60*30) + (1/60/60*34))); $astro = 108; $official = (90 + (1/60*50)); echo "Local Tenerife time<br>\n"; echo "sunriseAstro = " . gmdate("M d Y H:i:s", date_sunrise(1121208238, SUNFUNCS_RET_TIMESTAMP, $long, $lat, $astro, 1) + 60*60) . "<br>\n"; echo "sunriseOffical = " . gmdate("M d Y H:i:s", date_sunrise(1121208238, SUNFUNCS_RET_TIMESTAMP, $long, $lat, $official , 1) + 60*60) . "<br>\n"; echo "sunsetOffical = " . gmdate("M d Y H:i:s", date_sunset(1121208238, SUNFUNCS_RET_TIMESTAMP, $long, $lat, $official, 1) + 60*60) . "<br>\n"; echo "sunsetAstro = " . gmdate("M d Y H:i:s", date_sunset(1121208238, SUNFUNCS_RET_TIMESTAMP, $long, $lat, $astro, 1) + 60*60) . "<p>\n"; Expected result: ---------------- Local Tenerife time sunriseAstro = Jul 12 2005 05:47:50 sunriseOffical = Jul 12 2005 07:02:02 sunsetOffical = Jul 12 2005 19:09:17 sunsetAstro = Jul 12 2005 20:23:27 Actual result: -------------- Local Tenerife time sunriseAstro = Jul 12 2005 06:47:50 sunriseOffical = Jul 12 2005 08:02:02 sunsetOffical = Jul 12 2005 20:09:17 sunsetAstro = Jul 12 2005 21:23:27 -- Edit bug report at http://bugs.php.net/?id=33671&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33671&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33671&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33671&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33671&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33671&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33671&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33671&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33671&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33671&r=support Expected behavior: http://bugs.php.net/fix.php?id=33671&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33671&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33671&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33671&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33671&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33671&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33671&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33671&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33671&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33671&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33671&r=mysqlcfg

« previous php.bugs (#81777) next »