Forum OpenACS Development: Re: Timezones

Collapse
9: Re: Timezones (response to 5)
Posted by Bob Cassels on
[I haven't done anything with ACS for years, so this may be out-of-date.]

Yes you want to store all times in UTC.  Really the only thing you care about is that the time zone is one that doesn't use daylight time.  But GMT is the only one guaranteed to never switch to daylight time, since that's a political decision and GMT is not political.  (If you have times in a zone that uses daylight time, time differences are not reliable.)

Most of the times running around ACS stuff comes from the database (e.g. Oracle SYSDATE).  To have SYSDATE in UTC, just do "export TZ=GMT" in the database startup script.  Depending on your Unix, you may be able to use "export TZ=UTC", but they do the same thing.  (I know there's a difference, but the time routines don't.)  GMT is more widely known.

Unix keeps time in UTC, but often gives you "local" time, controlled by TZ.

Of course you can use this trick in the startup code for the server, or whatever process is running the code that is asking for the time.  Then you don't have to worry about changing any code that asks for local time.

You will have to make sure that places that present times switch to the client's preferred zone.

Collapse
10: Re: Timezones (response to 9)
Posted by Jeff Davis on
One other small gotcha is that if you use MTS with oracle
you need to make sure the listener is started with TZ=GMT
as well.