Forum OpenACS Development: Re: Timezones

Collapse
5: Re: Timezones (response to 1)
Posted by Lars Pind on
Jon,

I don't think you're missing anything.

I'm just trying to figure out how to do this bastard thing, so I'm asking around.

I'm aware of the timezone package in ref-timezones, which is also what the procs I mentioned in acs-lang use. We want a Tcl API on top of that, though, and that's what the acs-lang procs provide. ref-timezones doesn't have any Tcl API.

The issue of whether server time is UTC or not is still muddy to me. I happen to have no idea whether my server's time is set in UTC or not. When I say 'date' I get my local time. When I say 'date -u', I get UTC time. So far so good, but what it's running internally, I don't know.

How do I find out? How do I set it to UTC if it's not? And do we really want to *require* that *every* server ever running OpenACS must have its internal clock set to UTC?

So if the server's time isn't UTC, should we still store datetimes in UTC? I suppose you would all argue yes here, and I don't have a problem with that.

The other two issues are:

1) I'd like to not require that everybody installs ref-timezones in order to run OpenACS, since it's so big. It should be possible to run a single-timezone site without it.

So either everything should be written so it works without ref-timezones (it seems to be already), or we need to split ref-timezones into a small and a large package somehow. Recommendations here would be welcome.

2) This will require that we run through each and every piece of code in the system that either inputs or outputs a date/time and change them. That's a lot of work. Do you have any good ideas for how to go about this, or is it just grunt, grunt, grunt?

/Lars

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.