[pLog-svn] r2547 - plog/branches/plog-1.0.2/class/dao

Jon Daley plogworld at jon.limedaley.com
Thu Nov 10 03:33:19 GMT 2005


 	I didn't think about RSS.  And you are right, as of now, the RSS 
timestamp is wrong.  Except....

plog_articles date field:  2005-11-09 22:12:02
Posted at 2005-11-08, 23:12, with a -23 hour offset

So, the date is still being stored in the database in local time of 
the server.  So, I don't think I changed anything that would have broken 
the RSS stuff.

You are probably right that it would be better to store in UTC instead.

Currently, if the blog offset changes, all previously posted posts get the 
incorrect time, and if we stored UTC, we would calculate it correctly.

In summary, RSS is currently outputting wrong time stamps at least for my 
test server when the time_offset is -23.

On Wed, 9 Nov 2005, Paul Westbrook wrote:
> Hello,
>  How does this affect the display of dates?  The dates of the articles were 
> always in local time of the server.  As of revision r2422, the rss code 
> assumed this, and adjusted the display time accordingly.  I also believe that 
> for display purposes in the web interface, the offset was taken into account 
> when the page was drawn.
>
>  With this change, some articles will be in local time to the server, and 
> some will have their time adjusted.  It will be hard to determine whether the 
> time offset has been applied to a date and time in the database.
>
>  I think that a better fix will be to change the dates in the database to be 
> stored in UTC.  When the dates are displated, if it is not in valid UTC 
> format, it should be assumed to be in the time zone local to the server.
>
>
> --Paul
>
>
>
> On Nov 9, 2005, at 6:10 PM, jondaley at devel.plogworld.net wrote:
>
>> Author: jondaley
>> Date: 2005-11-10 02:09:26 +0000 (Thu, 10 Nov 2005)
>> New Revision: 2547
>> 
>> Modified:
>>   plog/branches/plog-1.0.2/class/dao/articles.class.php
>> Log:
>> added code to get blog specific time offset when adding an article.  This 
>> seems strange that it wasn't already here - people use this, right? 
>> removed unused textFilter object.
>> 
>> Modified: plog/branches/plog-1.0.2/class/dao/articles.class.php
>> ===================================================================
>> --- plog/branches/plog-1.0.2/class/dao/articles.class.php	2005-11-09 
>> 15:33:44 UTC (rev 2546)
>> +++ plog/branches/plog-1.0.2/class/dao/articles.class.php	2005-11-10 
>> 02:09:26 UTC (rev 2547)
>> @@ -695,13 +695,18 @@
>>          */
>>         function addArticle( &$newArticle )
>>         {
>> -            // first, we build up the query
>> -            $filter = new Textfilter();
>> +                // all this just to get the blog offset.
>> +            $blogInfo = $this->blogs->getBlogInfo( $newArticle->getBlog() 
>> );
>> +            $blogSettings = $blogInfo->getSettings();
>> +            $timeDiff = $blogSettings->getValue( 'time_offset' );
>> +            $articleDate = Timestamp::getDateWithOffset( 
>> $newArticle->getDate(), -($timeDiff));
>> +
>> +                // first, we build up the query
>>             $query = "INSERT INTO ".$this->getPrefix()."articles( 
>> user_id,blog_id,status,date,properties, slug )
>>                       VALUES ( ".$newArticle->getUser().",".
>>                       $newArticle->getBlog().",'".
>>                       $newArticle->getStatus()."','".
>> -                      $newArticle->getDate()."','".
>> +                      $articleDate."','".
>>                       serialize($newArticle->getProperties())."','".
>> 					  $newArticle->getPostSlug()."');";
>>             // and then we send it to the db
>> @@ -822,7 +827,6 @@
>>         {
>>             // we have to build up the query, which will be pretty long...
>>             $articleDate = Timestamp::getDateWithOffset( 
>> $article->getDate(), -($article->getTimeOffset()));
>> -            $filter = new Textfilter();
>>
>>             $query = "UPDATE ".$this->getPrefix()."articles SET id = 
>> ".$article->getId().
>>                      ", user_id = ".$article->getUser().
>> 
>> _______________________________________________
>> pLog-svn mailing list
>> pLog-svn at devel.plogworld.net
>> http://devel.plogworld.net/mailman/listinfo/plog-svn
>> 
>
> --
> Paul Westbrook
> paul at westbrooks.org
> <http://www.westbrooks.org>
>
>

**************************************
Jon Daley
http://jon.limedaley.com/plog/

In Hartford, CT, you aren't allowed to
cross a street while walking on your hands.



More information about the pLog-svn mailing list