From: matt-dated-1114405650 dot e8a5a2 at codewalkers dot com Operating system: ALL PHP version: 5CVS-2005-04-25 (dev) PHP Bug Type: Date/time related Bug description: date_sunrise and date_sunset don't handle GMT offset well.
Description: ------------ There seems to be a bug in date_sunrise and date_sunset when the GMT offset is greater than the sunrise or sunset time. For instance, if the date_sunset function returns '00:14' as the sunset time in GMT, trying to use the GMT offset of -4 would result in '-3:-4' being returned. In sunfuncs.c there is a line: ret = php_sunrise_sunset(N, latitude, longitude, zenith, calc_sunset) + gmt_offset; It seems that it should check if gmt_offset is greater than the returned value from php_sunrise_sunset and if so, add 24 to the returned value before the addition of gmt_offset. Reproduce code: --------------- <?php echo date("D M d Y"). ', sunset time : ' .date_sunset(time(), SUNFUNCS_RET_STRING, 40, -83, 90, -4); ?> Expected result: ---------------- I would expect to see: Sun Apr 24 2005, sunset time : 20:14 Actual result: -------------- I actually see: Sun Apr 24 2005, sunset time : -3:-4 -- Edit bug report at http://bugs.php.net/?id=32820&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32820&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32820&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32820&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32820&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32820&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32820&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32820&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32820&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32820&r=support Expected behavior: http://bugs.php.net/fix.php?id=32820&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32820&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32820&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32820&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32820&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32820&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32820&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32820&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32820&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32820&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32820&r=mysqlcfg