phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Phpgroupware-developers] datetime class localtime bug (causes a cal


From: Chris Weiss
Subject: Re: [Phpgroupware-developers] datetime class localtime bug (causes a calendar bug)
Date: Tue, 17 Dec 2002 03:44:38 +0000

hm.  Guess no one caught that I was totaly on the wrong track.  I finaly 
figured it
out and I know what needs fixed, and it's in setupIII.

First, adding the global to the header didn't work because the tz_offset 
actually
comes from the config table.  Turns out setup puts it there.  Setup blindly 
assumes
that the server is in GMT, which i'm guessing in reality most servers that 
serve a
single location (small to medium size buissness, or our target audence) are in 
local
time and make good use of the system timezone.

Solutions?
a) get rid of the too smart for its-own-good guess my time zone functions and 
just
flat out ask in setup for the tz offset
-or-
b) use some better magic to determine the tz the servers time is really set to 
and
set datetime->users_localtime corrrectly.

"a" adds a single trivial step to the setup app, and "b" is just plain 
complicated.

If there's agreemenet that this is indeed how it should be fixed I'll edit 
setup and
make a patch to do "a" just as soon as I find one of them rountuits

until then, and here's the really odd part:
1) go into setup and save the Step2 config, you don't have to change anything 
just
save it.
2) before anyone does anything edit the tz_offset field in phpgw_config table to
your tz offset, mine is zero "0".

for some reason just making the change in the table doesn't do it, I have to 
save
the config first.  Really strange though I'm sure there's a very good reason 
for it.

Chris Weiss (address@hidden) wrote*:
>
>ok this gets even more interesting:
>
>If $this->gmtnow is false the code is looking to see if "$GLOBALS['phpgw_info']
>['server']['tz_offset']" has been defined, except i can't find anywhere where 
>this
>value might be set.  If it somehow is set, $this->gmtnow = the server time - 
>this
>server tz_offet, then the users offset is applied and everything is fine.
>
>Since the server tz_offest is not set anywhere at all ever, it falls back to:
>
>$this->gmtnow = time() - ($this->getbestguess() * 3600);
>
>which seems harmless, until we look at getbestguess(), which on my server 
>returns -
>6 so that the line does return the correct GMT time, then adds my user pref
>tz_offest, which is 0 since i'm in the same tz as the server, to that and now 
>all
>the sudden i'm not in Central US time anymore!
>
>So basicaly the phpgwapi is assuming the servers time is GMT and isn't giving 
>any
>clear option to tell it otherwise.  I added "$GLOBALS['phpgw_info']['server']
>['tz_offset'] = 0;" to my header.inc.php.  I won't know if that does the trick 
>till
>later tonight, but it should work.
>
>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]