Menu

Leaguesite 0.6.6 Released

I think I have finally managed to fix/workaround the problem with the date and time being incorrect when the page is first loaded, but being correct every reload after that.

What appears to be happening is that some other module is calling PEAR::Date_TimeZone::inDaylightTime() when a user session starts (700-odd times!!), but doesn't call it again once the session is started.

The problem is that there appears to be a bug in inDaylightTime() which can mess up the timezone of the server, setting it incorrectly to UTC.(See http://pear.php.net/bugs/bug.php?id=1180 and http://www.modem-help.co.uk/help/diary20040412.html\)

So the first time the page is loaded the timezone is being set to UTC and start times were being interpreted at that timezone, then on further reloads the timezone returns to its correct setting and the start times are correct again.

I have fixed this by removing timezones from the equation. By using gmmktime() and gmdate() instead of mktime() and date() the code now ensures that time you enter when you create or edit a game is the time that is displayed irrespective of the timezone on the server. There are some corner cases such as showing "Today's" games where obviously "Today" should be defined by the local time, not GMT but I think I have accounted for those.

The other issue is what happens to games already in the database with the time in local time? The "update" code changes the game's starttime to give the expected results, but it is possible that if the timezone on your server is messed up then the updated times could be incorrect.

This bug has been driving me mad, but I believe it is now fixed so if you have been having this problem please download 0.6.6, give it a shot, and keep an eye open for any corner cases I might have missed!

Thanks to somydi_12, aaroneast, danthecook, and especially to gregjor over on http://forum.textdrive.com for their help in finding this one.

Oh yeah and...this release also fixes a missing semi-colon in uninstall.sql - thanks to danespen for pointing that one out.

If this is fixed I intend to start working on points-based standings tables to add to the games-back based ones, so hopefully that should arrive in the next week or two.

Posted by Richard Taylor 2005-04-05

Log in to post a comment.