[imp] Timezone Behavior

Cliff Green green@UMDNJ.EDU
Tue, 30 Jul 2002 04:00:38 -0400


Quoting Keith Hatfull <keith@hatfull.net>:

> Hi,
> 
> Just installed Horde 2.1 and IMP 3.1 on the following configuration:
> 
> Windows 2000 Server
> PHP 4.2.2
> Xitami Webserver v2.4d9
> MySQL 3.23.51
> 
> All seems to work ok, except for the oft reported timezone problem.
> 
> My timezone is set in my preferences as America/Chicago and the preference
> persists bewteen logins.  The time of last login is displayed correctly but
> the time in the compose window as well as the timestamps of all e-mails are
> 18 hours off....should be 23:45 as I type this, IMP shows 5:45.

I had a similar problem with PHP 4.2.1 under Solaris, with Apache 2.0.x; but no
problem with PHP 4.1.2 and Apache 1.3.x.  I "fixed" it by replacing all
date('r') calls in imp/compose.php with calls to strftime() with a properly
formatted date string, and a test for which timezone to use.

For example, here's a sample applied to $received:

! //         $received .= "\n\t" . date('r');
!          $tzoffset = (date('I')) ? '-0400' : '-0500';
!          $received .= "\n\t" .  strftime("%a, %d %b %Y %T $tzoffset (%Z)");

So, $tzoffset needs to be set somehow (I only cared about EST/DST, but YMMV -
there's got to be a better way to do that), then date('r') is replaced with
strftime("%a, %d %b %Y %T $tzoffset (%Z)").  This is done for all instances of
date('r') (4 times).

I have no such problem under linux, so I've assumed there's an issue with how
date() is called on those OSes.

-- 
Cliff Green
Academic Computing Services - UMDNJ
Signature under NDA