From: benjamin dot rich at gmail dot com Operating system: net time incorrectly calculated? PHP version: 4.3.10 PHP Bug Type: Date/time related Bug description: date("B") returns wrong net time - or does it?
Description: ------------ I was hyperventilating trying to solve a seemingly phantom bug in my script to do with net time (see bug 33082). It appeared, when I got down to it, that when I calculated net time with date() from the local clock, it would give me the correct net time: date("B", time()); but when I did it from a static timestamp - adjusted to local time - it showed the date and time correctly, but always screwed up the net time: //6:41am 2005-5-20 GMT: $test = date(@B", mktime(06,41,00,05,20,2005)); echo "should show @361: $test"; -> @403 I tried for some time to figure out why - it seemed - the date() function was adding an hour to the net time for these dates - and not, as I later found out through experimentation, the actual date or time they represented. For example, date("r @B") for the above might give me: fri 20 may 2005 06:41am @403. After long and painful, and unscientific, experimentation, I finally discovered the problem: the time it was giving *was* right - just not according to every net time calculator I entered the time into. For example - enter the date/time 5th May 1999, 6:41pm with location Austtralia, SYDNEY into one of the following net time calculators: http://www.help4web.net/adds/swatch.html and you get @361 http://www.users.bigpond.net.au/snakeman/converter.html and you get @403 Swatch's own converter thinks different: http://www.swatch.com/internettime/home.php gives @361 yet PHP's date() function will give you: @403. Something, somewhere, is not... calculating daylight savings correctly? It would appear something is awry. I thought I should bring this to the attention of the PHP devs. I mean... sure, nobody *uses* net-time... but come on! That's no excuse not to make it work properly =) For my own money, my own calculations show 403 is the correct net time for the above date. I worked it out as: Australia (Sydney) is EST, and during May, which is not daylight savings time, is GMT+10. Given that BMT, net time's meridian, is GMT+1, this means the net time for any given time in Australia is: ((Australian time in hours) - 9) * 41.666. 41.666 is the number of net-time 'beats' per hour. The above yields an answer of 403 for the given date/time (18:41 EST time 2005-5-20) -- Edit bug report at http://bugs.php.net/?id=33110&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33110&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33110&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33110&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33110&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33110&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33110&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33110&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33110&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33110&r=support Expected behavior: http://bugs.php.net/fix.php?id=33110&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33110&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33110&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33110&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33110&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33110&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33110&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33110&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33110&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33110&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33110&r=mysqlcfg