Date display wrong in Chora 0.6.1 and 1.0

John Hoffmann jhoffmann@vasoftware.com
Fri, 8 Feb 2002 19:29:15 -0500


---------------------- multipart/mixed attachment
The date display in Chora 0.6.1 and 1.0 is incorrect.

If you committed files at 13:00 EST, cvs would store the date in UTC format,
or 18:00 UTC. Chora would then call mktime on the UTC date that cvs gave it.   
mktime uses your local TZ setting, so now 18:00 (which was UTC, but treated
as EST) became 23:00. Then chora calls gmdate on this value, which treats it
as if it
were UTC, and displays a file modification time of 23:00 EST, even though
the file was committed at 13:00 EST.

I've reversed the order, so that it calls gmmktime, then date (not gmdate).
It seems to be working properly here, please test.  Of course I never
noticed before

Please see the attached diff file (to Chora 1.0).

-- 
John Hoffmann                       Mobile:            613-290-5217
Professional Services Engineer      Office:            510-687-6879
SourceForge, VA Software            Office Fax:        613-820-8411
http://www.vasoftware.com/sf        Email: jhoffmann@vasoftware.com

---------------------- multipart/mixed attachment
diff -duPr chora-1.0/cvs.php chora-1.0-modified/cvs.php
--- chora-1.0/cvs.php	Wed Jan  2 12:05:18 2002
+++ chora-1.0-modified/cvs.php	Fri Feb  8 18:36:20 2002
@@ -176,7 +176,7 @@
         }
 
         $textURL= Chora::url('co', $where, array('r'=>$rev));
-        $commitDate = gmdate('jS F Y, g:ia', $lg->date);
+        $commitDate = date('jS F Y, g:ia', $lg->date);
         $readableDate = CVSLib_File::readableTime($lg->date, true);
 
         $aid = $lg->queryAuthor();
diff -duPr chora-1.0/history.php chora-1.0-modified/history.php
--- chora-1.0/history.php	Wed Jan  2 12:05:19 2002
+++ chora-1.0-modified/history.php	Fri Feb  8 18:36:27 2002
@@ -197,7 +197,7 @@
             $bg = isset($branchColours[$bgbr]) ? $branchColours[$bgbr] : 'white';
             $log = $fl->logs[$rev]; 
             $author = Chora::showAuthorName($log->queryAuthor());
-            $date = gmdate('jS M Y', $log->queryDate());
+            $date = date('jS M Y', $log->queryDate());
             $lines = $log->queryChangedLines();
             include $registry->getTemplatePath() . '/history/rev.inc';
 
diff -duPr chora-1.0/lib/CVSLib/Log.php chora-1.0-modified/lib/CVSLib/Log.php
--- chora-1.0/lib/CVSLib/Log.php	Sat Aug 11 16:59:31 2001
+++ chora-1.0-modified/lib/CVSLib/Log.php	Fri Feb  8 18:36:48 2002
@@ -45,7 +45,7 @@
             case CVSLIB_LOG_DATE:
                 $line = array_shift($raw);
                 if (preg_match("|^date:\s+(\d+)/(\d+)/(\d+)\s+(\d+):(\d+):(\d+);\s+author:\s+(\S+);\s+state:\s+(\S+);(\s+lines:\s+([0-9\s+-]+))?|", $line, $parts)) {
-                    $this->date = mktime($parts[4], $parts[5], $parts[6], $parts[2], $parts[3], $parts[1]);
+                    $this->date = gmmktime($parts[4], $parts[5], $parts[6], $parts[2], $parts[3], $parts[1]);
                     $this->author = $parts[7];
                     $this->state = $parts[8];
                     $this->lines = isset($parts[10])?$parts[10]:'';

---------------------- multipart/mixed attachment--


>From chuck@horde.org Date: Sat,  9 Feb 2002 00:28:02 -0500
Return-Path: <chuck@horde.org>
Mailing-List: contact chora-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list chora@lists.horde.org
Received: (qmail 48083 invoked from network); 9 Feb 2002 05:28:39 -0000
Received: from h00104bc60b3c.ne.mediaone.net (HELO marina.horde.org) (24.91.196.127)
  by clark.horde.org with SMTP; 9 Feb 2002 05:28:39 -0000
Received: by marina.horde.org (Postfix, from userid 33)
	id A3B8339F4; Sat,  9 Feb 2002 00:28:02 -0500 (EST)
Received: from 192.168.0.131 ( [192.168.0.131])
	as user chuck@localhost by marina.horde.org with HTTP;
	Sat,  9 Feb 2002 00:28:02 -0500
Message-ID: <1013232482.3c64b3627a752@marina.horde.org>
Date: Sat,  9 Feb 2002 00:28:02 -0500
From: Chuck Hagenbuch <chuck@horde.org>
To: chora@lists.horde.org
References: <20020209002915.GH26215@vasoftware.com>
In-Reply-To: <20020209002915.GH26215@vasoftware.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 4.0-cvs
Subject: Re: [chora] Date display wrong in Chora 0.6.1 and 1.0

Quoting John Hoffmann <jhoffmann@vasoftware.com>:

> If you committed files at 13:00 EST, cvs would store the date in UTC format,
> or 18:00 UTC. Chora would then call mktime on the UTC date that cvs gave it. 
> mktime uses your local TZ setting, so now 18:00 (which was UTC, but treated
> as EST) became 23:00. Then chora calls gmdate on this value, which treats it
> as if it
> were UTC, and displays a file modification time of 23:00 EST, even though
> the file was committed at 13:00 EST.
> 
> I've reversed the order, so that it calls gmmktime, then date (not gmdate).
> It seems to be working properly here, please test.  Of course I never
> noticed before

I've reproduced the problem and this fixes it as advertised. Committed, thanks!

-chuck

--
Charles Hagenbuch, <chuck@horde.org>
"What was and what may be, lie, like children whose faces we cannot see, in the
arms of silence. All we ever have is here, now." - Ursula K. Le Guin