[pLog-svn] r2415 - in plog/branches/plog-1.0.2: class/locale
templates/rss
Jon Daley
plogworld at jon.limedaley.com
Thu Aug 25 23:38:43 GMT 2005
Okay, finally got a chance to look at this. If I am understanding
the RSS feed correctly
(http://jon.limedaley.com/plog/rss/rss20/1)
I am looking at "Weekend Weekend Sailing Adventures, Part II"
which was posted at 13:49, and correctly shows that time on the admin
and user side.
In the RSS document, it says: "Thu, 25 Aug 2005 13:25:09 -0400"
My computer is set to EDT, but my RSS reader prints out 12:25.
So, that means it is a bug in the reader?
On Fri, 19 Aug 2005, Paul Westbrook wrote:
> Hello,
> This works for me. My server is in the same time zone as me, so my offset
> is 0. The dates are reported with the -0700 offset, which is correct for PST
> now.
>
> When I changed the offset, the times changed to reflect that timezone, and
> the timezone offset also changed correctly. What offset are you using? What
> offset is being added to the dates in the rss feed? It should be -0400 for
> EDT.
>
> The DST bug will only be a problem when the time that is being formatted is
> across a DST boundary.
>
>
> --Paul
>
>
> On Aug 19, 2005, at 5:02 AM, Jon Daley wrote:
>
>> Does this work for you? It appears to do pretty strange things for me.
>> Server is in same timezone as me. EST.
>>
>> Posts show correct time, RSS feed show DST bug that you mention.
>>
>> I thought I would try adding a +1 to see what that did to the DST bug.
>> The post times went ahead 2 hours, RSS feeds stayed the same!!?
>>
>>
>> On Fri, 19 Aug 2005, pwestbro at devel.plogworld.net wrote:
>>
>>
>>> Author: pwestbro
>>> Date: 2005-08-19 07:20:20 +0000 (Fri, 19 Aug 2005)
>>> New Revision: 2415
>>>
>>> Modified:
>>> plog/branches/plog-1.0.2/class/locale/locale.class.php
>>> plog/branches/plog-1.0.2/templates/rss/atom.template
>>> plog/branches/plog-1.0.2/templates/rss/rss090.template
>>> plog/branches/plog-1.0.2/templates/rss/rss20.template
>>> Log:
>>> Fixed the last part of bug http://bugs.plogworld.net/view.php?id=442
>>>
>>> Now the dates are output in local time of the poster, and not the server.
>>> If the blog info is passed into formatDate, the timeoffset is used to
>>> correct the time zone offset. Printing the dates in local time zone,
>>> allow
>>> additional information to be available, that is lost when converting to
>>> GMT.
>>>
>>> There may still be a problem when dealing with the boundary with daylight
>>> saving time. If the current date has DST in effect, and the post date
>>> does
>>> not, the time zone offset may be incorrect. This could potentially be
>>> solved by passing the date that is being parsed into the date("Z") call.
>>> The documentation doesn't say what happens in this case.
>>>
>>> Also, fixed a mistake in my last checkin. There was a conditional that
>>> was
>>> always true, so I just removed the conditional
>>>
>>>
>>> Modified: plog/branches/plog-1.0.2/class/locale/locale.class.php
>>> ===================================================================
>>> --- plog/branches/plog-1.0.2/class/locale/locale.class.php 2005-08-18
>>> 21:12:48 UTC (rev 2414)
>>> +++ plog/branches/plog-1.0.2/class/locale/locale.class.php 2005-08-19
>>> 07:20:20 UTC (rev 2415)
>>> @@ -475,6 +475,7 @@
>>> * <li>%S seconds</li>
>>> * <li>%y 2-digit year representation</li>
>>> * <li>%Y 4-digit year representation</li>
>>> + * <li>%O Difference to Greenwich time (GMT) in hours</li>
>>> * <li>%% the '%' character
>>> * </ul>
>>> * (these have been added by myself and are therefore incompatible
>>> with php)<ul>
>>> @@ -482,7 +483,7 @@
>>> * <li>%D cardinal representation of the day</li>
>>> * </ul>
>>> */
>>> - function formatDate( $timeStamp, $format = null )
>>> + function formatDate( $timeStamp, $format = null, $blog = null )
>>> {
>>> // load the file if it hadn't been loaded yet
>>> if( !is_array($this->_messages))
>>> @@ -496,6 +497,26 @@
>>> // and the same for the weekdays
>>> $weekdayId = $timeStamp->getWeekdayId();
>>> $weekday = $this->_messages["days"][$weekdayId];
>>> +
>>> + // Get the time zone offset for the server
>>> + $timeZoneSec = date("Z");
>>> + if ( $blog ) {
>>> + //
>>> + // The blog was specified. Use it to get the time offset
>>> + //
>>> + $timeDiff = 0;
>>> + $blogSettings = $blog->getSettings();
>>> + $timeDiff = $blogSettings->getValue( 'time_offset' );
>>> +
>>> + // The following line relies on the fact that the result
>>> will
>>> + // be an int.
>>> + $timeZoneSec += ( $timeDiff * 3600 );
>>> + }
>>> + // Now convert the time zone seconds to hours and minutes
>>> + $timeZoneHours = intval( abs($timeZoneSec) / 3600 );
>>> + $timeZoneMins = intval(( abs($timeZoneSec) % 3600 ) / 60 );
>>> + $timeZoneDirection = ($timeZoneSec < 0 ) ? "-" : "+";
>>> +
>>>
>>> // if the user did not specify a format, let's use the default
>>> one
>>> if( $format == null )
>>> @@ -518,6 +539,7 @@
>>> $values["%S"] = $timeStamp->getSeconds();
>>> $values["%y"] = substr($timeStamp->getYear(), 2, 4 );
>>> $values["%Y"] = $timeStamp->getYear();
>>> + $values["%O"] = sprintf( "%s%02d%02d", $timeZoneDirection,
>>> $timeZoneHours, $timeZoneMins );
>>> $values["%%"] = "%";
>>> $values["%T"] = $this->getDayOrdinal( $timeStamp )."
>>> ".$this->tr("of")." ".$monthStr;
>>> $values["%D"] = $this->getDayOrdinal( $timeStamp );
>>> @@ -561,6 +583,7 @@
>>> * <li>%S seconds</li>
>>> * <li>%y 2-digit year representation</li>
>>> * <li>%Y 4-digit year representation</li>
>>> + * <li>%O Difference to Greenwich time (GMT) in hours (Will
>>> always be +0000)</li>
>>> * <li>%% the '%' character
>>> * </ul>
>>> * (these have been added by myself and are therefore incompatible
>>> with php)<ul>
>>> @@ -579,11 +602,9 @@
>>> // The blog was specified. Use it to get the time offset
>>> //
>>> $timeDiff = 0;
>>> - if( $this->_blogInfo == null ) {
>>> - $blogSettings = $blog->getSettings();
>>> - $timeDiff = $blogSettings->getValue( 'time_offset' );
>>> - $timeDiff *= -1;
>>> - }
>>> + $blogSettings = $blog->getSettings();
>>> + $timeDiff = $blogSettings->getValue( 'time_offset' );
>>> + $timeDiff *= -1;
>>>
>>> if( $timeDiff > 0 )
>>> $timeStamp->addSeconds( $timeDiff * 3600 );
>>> @@ -639,6 +660,7 @@
>>> $values["%S"] = gmdate( "s", $time );
>>> $values["%y"] = gmdate( "y", $time );
>>> $values["%Y"] = gmdate( "Y", $time );
>>> + $values["%O"] = "+0000";
>>> $values["%%"] = "%";
>>> $values["%T"] = $this->getDateOrdinal( gmdate( "d", $time ) )."
>>> ".$this->tr("of")." ".$monthStr;
>>> $values["%D"] = $this->getDateOrdinal( gmdate( "d", $time ) );
>>>
>>> Modified: plog/branches/plog-1.0.2/templates/rss/atom.template
>>> ===================================================================
>>> --- plog/branches/plog-1.0.2/templates/rss/atom.template 2005-08-18
>>> 21:12:48 UTC (rev 2414)
>>> +++ plog/branches/plog-1.0.2/templates/rss/atom.template 2005-08-19
>>> 07:20:20 UTC (rev 2415)
>>> @@ -3,7 +3,7 @@
>>> <title>{$blog->getBlog()|escape}</title>
>>> <link rel="alternate" type="text/html" href="{$url->blogLink()}" />
>>> {assign var="newestDate" value=$posts[0]->getDateObject()}
>>> -<modified>{$locale->formatDateGMT($newestDate, "%Y-%m-%dT%H:%M:%S-00:00",
>>> $blog)}</modified>
>>> +<modified>{$locale->formatDate($newestDate, "%Y-%m-%dT%H:%M:%S%O",
>>> $blog)}</modified>
>>> <tagline>{$blog->getAbout()|escape}</tagline>
>>> <generator url="http://www.plogworld.net/"
>>> version="1.0.1">pLog</generator>
>>> {assign var="blogOwner" value=$posts[0]->getUserInfo()}
>>> @@ -14,9 +14,9 @@
>>> <title>{$post->getTopic()|escape}</title>
>>> <link rel="alternate" type="text/html" href="{$url->postPermalink($post)}"
>>> />
>>> {assign var="postDate" value=$post->getDateObject()}
>>> - <modified>{$locale->formatDateGMT($postDate, "%Y-%m-%dT%H:%M:%S-00:00",
>>> $blog)}</modified>
>>> - <issued>{$locale->formatDateGMT($postDate, "%Y-%m-%dT%H:%M:%S-00:00",
>>> $blog)}</issued>
>>> - <created>{$locale->formatDateGMT($postDate, "%Y-%m-%dT%H:%M:%S-00:00",
>>> $blog)}</created>
>>> + <modified>{$locale->formatDate($postDate, "%Y-%m-%dT%H:%M:%S%O",
>>> $blog)}</modified>
>>> + <issued>{$locale->formatDate($postDate, "%Y-%m-%dT%H:%M:%S%O",
>>> $blog)}</issued>
>>> + <created>{$locale->formatDate($postDate, "%Y-%m-%dT%H:%M:%S%O",
>>> $blog)}</created>
>>> <summary type="text/plain">{$post->getText()|strip_tags|truncate:200:"
>>> ..."|escape:"html"}</summary>
>>> <author>
>>> {assign var="postOwner" value=$post->getUserInfo()}
>>>
>>> Modified: plog/branches/plog-1.0.2/templates/rss/rss090.template
>>> ===================================================================
>>> --- plog/branches/plog-1.0.2/templates/rss/rss090.template 2005-08-18
>>> 21:12:48 UTC (rev 2414)
>>> +++ plog/branches/plog-1.0.2/templates/rss/rss090.template 2005-08-19
>>> 07:20:20 UTC (rev 2415)
>>> @@ -16,7 +16,7 @@
>>> <description>{$post->getText()|escape}</description>
>>> <link>{$url->postPermalink($post)}</link>
>>> {assign var="postDate" value=$post->getDateObject()}
>>> - <pubDate>{$locale->formatDateGMT($postDate, "%a, %d %b %Y %H:%M:%S
>>> GMT", $blog)}</pubDate>
>>> + <pubDate>{$locale->formatDate($postDate, "%a, %d %b %Y %H:%M:%S %O",
>>> $blog)}</pubDate>
>>> </item>
>>> {/foreach}
>>> </rdf:RDF>
>>>
>>> Modified: plog/branches/plog-1.0.2/templates/rss/rss20.template
>>> ===================================================================
>>> --- plog/branches/plog-1.0.2/templates/rss/rss20.template 2005-08-18
>>> 21:12:48 UTC (rev 2414)
>>> +++ plog/branches/plog-1.0.2/templates/rss/rss20.template 2005-08-19
>>> 07:20:20 UTC (rev 2415)
>>> @@ -9,7 +9,7 @@
>>> <title>{$blog->getBlog()|escape}</title>
>>> <link>{$url->blogLink()}</link>
>>> <description>{$blog->getAbout()|escape}</description>
>>> - <pubDate>{$locale->formatDateGMT($now, "%a, %d %b %Y %H:%M:%S
>>> GMT")}</pubDate>
>>> + <pubDate>{$locale->formatDate($now, "%a, %d %b %Y %H:%M:%S
>>> %O")}</pubDate>
>>> <generator>http://www.plogworld.net</generator>
>>> {foreach from=$posts item=post}
>>> <item>
>>> @@ -26,7 +26,7 @@
>>> <category>{$category->getName()|escape}</category>
>>> {/foreach}
>>> {assign var="postDate" value=$post->getDateObject()}
>>> - <pubDate>{$locale->formatDateGMT($postDate, "%a, %d %b %Y %H:%M:%S
>>> GMT", $blog)}</pubDate>
>>> + <pubDate>{$locale->formatDate($postDate, "%a, %d %b %Y %H:%M:%S %O",
>>> $blog)}</pubDate>
>>> <source
>>> url="{$url->rssLink("rss20")}">{$blog->getBlog()|escape}</source>
>>> {foreach from=$post->getArticleResources() item=resource}
>>> {** please uncomment the line below if you'd like to server everything
>>> but images, instead of
>>>
>>> _______________________________________________
>>> pLog-svn mailing list
>>> pLog-svn at devel.plogworld.net
>>> http://devel.plogworld.net/mailman/listinfo/plog-svn
>>>
>>>
>>
>> **************************************************************
>> * * The reason houses are made of *
>> * Jon Daley * brick instead of aluminum *
>> * * foil is the thermal *
>> * http://jon.limedaley.com/ * diffusivity. *
>> * * -- Professor Shaeffer *
>> **************************************************************
>> _______________________________________________
>> 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>
>
>
http://jon.limedaley.com/plog/
Happiness is not a station you arrive at, but a manner of traveling.
-- Margaret Lee Runbeck
More information about the pLog-svn
mailing list