Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: djamell on May 25, 2009, 12:29:35 PM

Title: Inbox Date is Wrong
Post by: djamell on May 25, 2009, 12:29:35 PM
Using RC 0.2.2 with hMailServer 5.1.1-B341, MySQL 5.1.34, PHP 5.2.9-2

When I send mail through hMail using MS Outlook on both ends, the time and date are correct.  When I open the Inbox in RC, the times are wrong.  It seems like no matter what time I send/receive, RC always shows it as somewhere in the 5:00AM range (5:18 AM, 5:37AM).

Even if I send the mail from RC, it displays the wrong time even though the message received in Outlook displays the correct one. When I check the "Sent" Folder it shows I sent the message at 5:34AM when I actually sent it at 11:27AM.  Outlook displays correctly.

Where is RC getting this time?
Title: Inbox Date is Wrong
Post by: JohnDoh on May 25, 2009, 03:07:06 PM
RC tries to convert the time of the message into your timezone, as set in your preferences. itsodd that it is not out by a regular ammount. first stop should be to check your timezone setting. if the messages where sent by RC then it shouldnt have any problem parsing the date/time.
Title: Inbox Date is Wrong
Post by: djamell on May 27, 2009, 11:11:02 AM
I've got the Timezone under preferences set to (GMT -6:00) Central Time which is also where the hMailServer server and RC are located.  Both applications are running on the same box.

UPDATE:  The times that are shown under the "Date" column are either 5:xx AM or 5:xx PM depending on whether they were received in the morning or afternoon.  Regardless, the first digit is always a "5"
Title: Inbox Date is Wrong
Post by: djamell on May 28, 2009, 01:20:35 PM
Would there be any merit to setting

$rcmail_config['timezone'] = 'auto';

in the main.inc.php file to something other than 'auto'?

What would the correct setting be for US/Central Timezone?
Title: Inbox Date is Wrong
Post by: djamell on May 30, 2009, 07:35:12 AM
Bump, please.
Title: Inbox Date is Wrong
Post by: djamell on June 13, 2009, 11:45:27 AM
After much experimentation I find the the first number in the time is now a "6" instead of a "5".  The time can be AM or PM, but always starts with a 6.

I've tried every conceivable combination under "Personal Settings"

Can anyone shed some light on this?
Title: Inbox Date is Wrong
Post by: bpat1434 on June 14, 2009, 10:32:02 AM
Out of curisoity, take a look at the messages date vs time.  Does the date always have a 6 in it and last month it always had a 5 in it?  I.e. no date has anything different?  If that's so, I'd look in programs/main/inc.php and look at the function "format_date" and see if you see anything wrong with your version.  I don't see anything wrong from a code perspective, but if I have time, I'll install 0.2.2 and see if I can recreate your issue.
Title: Inbox Date is Wrong
Post by: djamell on June 14, 2009, 06:46:03 PM
I have 270 messages in my inbox dating back to last month and no time as anything other than 6:xxam or 6:xxpm.  I rather suspact that the change from 5 to 6 had something to do with me getting DST set properly (or improperly).

I could not find the path/file "programs/main/inc.php" within the Roundcube prgram structure but did find "programs/include/main.inc"

In that file I find the following code:

function format_date($date, $format=NULL)
  {
  global $CONFIG;
 
  $ts = NULL;

  if (is_numeric($date))
    $ts = $date;
  else if (!empty($date))
    {
    // support non-standard "GMTXXXX" literal
    $date = preg_replace('/GMT\s*([+-][0-9]+)/', '\\1', $date);
    // if date parsing fails, we have a date in non-rfc format.
    // remove token from the end and try again
    while ((($ts = @strtotime($date))===false) || ($ts < 0))
      {
        $d = explode(' ', $date);
        array_pop($d);
        if (!$d) break;
        $date = implode(' ', $d);
      }
    }

  if (empty($ts))
    return '';
   
  // get user's timezone
  if ($CONFIG['timezone'] === 'auto')
    $tz = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : date('Z')/3600;
  else {
    $tz = $CONFIG['timezone'];
    if ($CONFIG['dst_active'])
      $tz++;
  }


It's hard for me to tell if there's anything wrong with the code.

I originally tried to run Roundcube using MS SQL instead of MySQL but had time problems there as well.  I can't help but think there's a connection somehow.  I'd really like to run this under MS SQL, so as a possible additional "clue" to what's going on here I'll reference that forum thread as well.

DB Time: NOT OK using MSSQL (http://www.roundcubeforum.net/general-discussion/4768-db-time-not-ok-using-mssql.html)

I should also probably point out that hMailServer is using MS SQL in all cases.

Thanks in advance for your help.