[Zope] Time zones (another try)
ken
ken@cleveland.lug.net
Thu, 12 Dec 2002 15:16:02 -0500 (EST)
Richard,
I'm not following the rational for wanting your database to think it's
GMT, but that's okay. Whatever time you want MySQL to think it is can
be set at the command line with the --timezone option, like
--timezone=UTC
If you're curious, this is processed by /usr/bin/safe_mysqld. Also
check to see if there's something in /etc/my.conf like
TZ=PST8PDT
export TZ
Again, change the value to your desired timezone.
hth,
ken
Richard Wesley at 08:09 (UTC-0800) on Thu, 12 Dec 2002 said:
= 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
=
= _______________________________________________
= Zope maillist - Zope@zope.org
= http://lists.zope.org/mailman/listinfo/zope
= ** No cross posts or HTML encoding! **
= (Related lists -
= http://lists.zope.org/mailman/listinfo/zope-announce
= http://lists.zope.org/mailman/listinfo/zope-dev )
=