I am using Pear::Calendar as the basis for an event system, my question is about dealing with timezones.
I store all the times in the database in GMT using the http://uk.php.net/manual/en/function.gmmktime.php function. This is so that that is the server moves, the user changes their timezone etc or any other factor then we don't have to update times in the database. When a time is acutally used, it is processed by adding/subtracting hours to get into user's timezone (and DST considered as well).
This is where my question about using PEAR:Calendar comes into play.
At the moment, our calendar app is inconsistant, one of the reasons it is being rewritten. It uses mySQL DATE and TIME for storage but I am planning on changing this to timestamps.
But I do not quite understand how this is going to affect putting dates into PEAR::Calendar. What is PEAR::Calendar's timezone based on? I think it is based on mktime(), which is the server time which is thus a big problem. Would a recommended solution be to change all the calls to mktime() to gmtime() and then before passing an event to the calendar, i do our normal timestamp adjustment? Then that event would appear on the calendar in the correct place, according to that user's timestamp?
Thank you for any suggestions/help regarding this.
The way our system currently works is having all times in GMT (in software and database) and then when a user sends a time using a form we convert into GMT, and when we ever display a time we convert out of GMT. So we have tw functions to_gmt() and from_gmt() that take account of user settings, server settings etc
I have modifed the UnixTs to use gmmktime() instead of mktime() which I think should work fine, there where only two calls to it and two calls to date() instead of gmdate which needed updating. I *think* that might be all I need to do, but not 100% sure.