[Zope] Time zones (another try)

Richard Wesley hawkfish@electricfish.com
Thu, 12 Dec 2002 12:44:57 -0800


At 12:24 PM -0500 12/12/02, Russell Hires wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>
>>  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.
>So you're using Linux. Couldn't you write a trigger that gets the hwclock()
>time?
>
>Why are you having MySQL keep up with the time? Why not just deal with
>ZopeTime, then subtract the appropriate amount of time based on whether it's
>DST or not?

The database should store times as GMT - this is a good idea simply 
because it gets rid of representation issues and silly problems like 
DST.  Time zones then become simply a display issue and times in the 
database are well behaved and  absolute.

>After all, how does your computer know when to change its clock
>(to DST or back)?

My computer (at least on Linux) does not change its clock at all - 
all it does is change the string that is displayed.  That string 
depends upon the system time zone.  The problem is that while Zope's 
DateTime class is smart and understands absolute time and how to 
represent it in a particular time zone, MySQL does _not_ understand 
absolute time and makes assumptions that are not very robust, e.g. 
what happens to stored dates if you move the machine to another time 
zone?

So, the question remains:  Does anyone have a goo way to get MySQL 
and/or its Zope DB adapter to handle dates in GMT rather than local 
time?

TIA,
Sincerely,

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