[Zope] Time zones (another try)

Richard Wesley hawkfish@electricfish.com
Thu, 12 Dec 2002 08:09:13 -0800


At 7:54 PM -0500 12/11/02, ken wrote:
>I don't know what OS you're using, but there's probably three things
>going on here.  On typical UNIX systems-- and this includes Linux--
>there's (1) a hardware clock, (2) a system clock, and then (3) whatever
>time the database may think it is-- (3) should be the same as (2).

Linux, set to PST.

>I'd recommend setting the hardware clock to UTC, then set the correct
>timezone so that system time tells the correct local time.

That is the current situation.

>Then see
>what time the database thinks it is.

That is an interesting suggestion.  MySQL has a Now() function.

The problem is that MySQL's date appears to have no Time Zone 
information attached to it, so the convention is to store times as 
GMT (thus avoiding DST issues).  But a quick check of the main server 
indicates that the database thinks it is in PST as well.

>Doing the quick fix you're
>contemplating below will come back to bite you.  E.g., what are you
>going to do in the DST flips?

That is why we want to use GMT.

>No one wants the wrong time attached to
>their data, but, at the same time, I'm sure you don't want to sit there
>at 2am twice a year to change the time.  I've been using Linux for ten
>years and for ten years it's handled the switch to/from DST perfectly.
>This is really the way you want to go.

As I mentioned, we are using Linux, and this is not a problem.

>While you're there, look into rdate.  This won't get you out of the
>UTC/localtime configuration; rdate fetches the correct time from time a
>server (my systems do this once a day) and so keeps the time on your
>system accurate.

We have this on all our systems.

>All of this really should be required for an enterprise system.

Agreed, and we are doing the basics (rdate daemon).  But the central 
issue remains:  How do I convince MySQL to store dates as GMT, not 
local time?  Judging from the Now() test I just did, the only 
solution is to change the system time to GMT.
Sincerely,

Richard Wesley
Co-President, Electric Fish, Inc.
<http://www.electricfish.com/>
(v) +1-206-493-1690x210
(f) +1-206-493-1697