ID:               33110
 User updated by:  benjamin dot rich at gmail dot com
 Reported By:      benjamin dot rich at gmail dot com
 Status:           Open
 Bug Type:         Date/time related
-Operating System: net time incorrectly calculated?
+Operating System: Linux, Mac OSX
 PHP Version:      4.3.10
 New Comment:

updated wrong operating system designation for bug


Previous Comments:
------------------------------------------------------------------------

[2005-05-23 13:11:58] benjamin dot rich at gmail dot com

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 this bug report at http://bugs.php.net/?id=33110&edit=1

Reply via email to