Bug 92549

Summary: Error displaying feed dates !
Product: [Applications] akregator Reporter: Glennie Vignarajah <glennie>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description Glennie Vignarajah 2004-11-01 23:13:19 UTC
Version:           1.0-Beta7 (using KDE KDE 3.3.1)
Installed from:    Debian testing/unstable Packages
OS:                Linux

When displaying feeds from http://www.freenews.fr/feeds/rss.php, dates *aren't* displyed correctly (always shows 01/01/1970) !
Comment 1 Teemu Rytilahti 2004-11-18 15:29:13 UTC
What version are you using? For me they seem to look fine...
Comment 2 Frank Osterfeld 2004-11-18 16:00:41 UTC
I can confirm that this feed had articles with date set to 1970/01/01 in akregator (still got them in the feed archive). Apparently the issue is solved now in the rss file. I remember that the rss file used some uncommon date format like "2004-10-20" (can't remember the exact format), but that's fixed now.

I think akregator should handle article with pubDates it can't parse the same way it handles articles without pubdate at all (instead of using 1970/01/01).
Comment 3 Glennie Vignarajah 2004-11-18 23:02:07 UTC
 I had the bug when I sent the bug report. As Frank said, it seems the site has changed the RSS file format and now, 
akregator handles dates fine. Sorry for the noise !
Comment 4 Frank Osterfeld 2004-11-19 10:28:25 UTC
I reopen this because I think akregator should ignore pubdates that can't be parsed (use fetch time then) instead of setting date to 1970/01/01.
Comment 5 Teemu Rytilahti 2004-11-23 20:24:31 UTC
Example of feed which dates are shown incorrectly:

<?xml version="1.0"  encoding="ISO-8859-15"?>
<!-- mureakuha RSS feed -->
<rss version="2.0">
<channel>
<title>Mureakuha : keskustelut</title>
<link>http://mureakuha.com</link>
<description></description>
<language>fi</language>
<copyright>Mureakuha</copyright>
<webMaster>admin@mureakuha.com</webMaster>
<docs>http://backend.userland.com/rss</docs>
<item>
	<title>C/C++</title>
	<link>http://mureakuha.com/keskustelut/3?7407</link>
	<description>Hyviä winapi tutoriaaleja.</description>
	<pubDate>04:40 23.11.04</pubDate>
</item><item>
	<title>Muu Ohjelmointi</title>
	<link>http://mureakuha.com/keskustelut/9?7406</link>
	<description>Osaako kukaan sanoa mistä löytyy Hot or not tyylinen scripti?</description>
	<pubDate>23:44 22.11.04</pubDate>
</item><item>
	<title>C/C++</title>
	<link>http://mureakuha.com/keskustelut/3?7405</link>
	<description>Windows ohjelmoinnista??</description>
	<pubDate>22:00 22.11.04</pubDate>
</item><item>
	<title>PHP</title>
	<link>http://mureakuha.com/keskustelut/2?7404</link>
	<description>Kävijöiden ohjaus</description>
	<pubDate>21:12 22.11.04</pubDate>
</item><item>
	<title>Java</title>
	<link>http://mureakuha.com/keskustelut/4?7403</link>
	<description>RegExp ongelma</description>
	<pubDate>14:59 22.11.04</pubDate>
</item><item>
	<title>C/C++</title>
	<link>http://mureakuha.com/keskustelut/3?7402</link>
	<description>Open file -dialogi</description>
	<pubDate>14:55 22.11.04</pubDate>
</item><item>
	<title>PHP</title>
	<link>http://mureakuha.com/keskustelut/2?7401</link>
	<description>?? php sivut näyttävät hepreaa. Pähkinä?</description>
	<pubDate>12:21 22.11.04</pubDate>
</item><item>
	<title>PHP</title>
	<link>http://mureakuha.com/keskustelut/2?7400</link>
	<description>Taulukkon asettelu</description>
	<pubDate>09:42 22.11.04</pubDate>
</item><item>
	<title>Yleistä Höpinää</title>
	<link>http://mureakuha.com/keskustelut/1?7399</link>
	<description>Firefox ja kehysten tulostamien (Print Frames poissa)</description>
	<pubDate>22:00 21.11.04</pubDate>
</item><item>
	<title>Python/Ruby/Perl</title>
	<link>http://mureakuha.com/keskustelut/12?7397</link>
	<description>Tiedostoon tulostuksessa kummallinen varoitus</description>
	<pubDate>17:34 21.11.04</pubDate>
</item><item>
	<title>Visual Basic / C# / .NET</title>
	<link>http://mureakuha.com/keskustelut/11?7396</link>
	<description>vb6 ja constructorit</description>
	<pubDate>14:50 21.11.04</pubDate>
</item><item>
	<title>C/C++</title>
	<link>http://mureakuha.com/keskustelut/3?7395</link>
	<description>Linux c++ ohjelmointi- opas</description>
	<pubDate>14:35 21.11.04</pubDate>
</item><item>
	<title>Java</title>
	<link>http://mureakuha.com/keskustelut/4?7394</link>
	<description>NetBeans aloittaminen???!</description>
	<pubDate>23:03 20.11.04</pubDate>
</item><item>
	<title>Muu Ohjelmointi</title>
	<link>http://mureakuha.com/keskustelut/9?7393</link>
	<description>Postgresin vastaava komento (mysql_inserted_id)</description>
	<pubDate>18:22 20.11.04</pubDate>
</item><item>
	<title>Yleistä Höpinää</title>
	<link>http://mureakuha.com/keskustelut/1?7392</link>
	<description>Telewell TW-EA-500 ADSL  purkin palomuuriin reikä</description>
	<pubDate>18:03 20.11.04</pubDate>
</item><item>
	<title>Java</title>
	<link>http://mureakuha.com/keskustelut/4?7390</link>
	<description>J2ME ohjelman lopetus canvas luokasta</description>
	<pubDate>15:40 20.11.04</pubDate>
</item><item>
	<title>Yleistä Höpinää</title>
	<link>http://mureakuha.com/keskustelut/1?7389</link>
	<description>SSL - sivusto</description>
	<pubDate>15:33 20.11.04</pubDate>
</item><item>
	<title>Visual Basic / C# / .NET</title>
	<link>http://mureakuha.com/keskustelut/11?7388</link>
	<description>Säikeet + delegaatit + metodien parametrit</description>
	<pubDate>14:01 20.11.04</pubDate>
</item><item>
	<title>Visual Basic / C# / .NET</title>
	<link>http://mureakuha.com/keskustelut/11?7387</link>
	<description>C#, dataSet ja comboBox</description>
	<pubDate>13:51 20.11.04</pubDate>
</item><item>
	<title>PHP</title>
	<link>http://mureakuha.com/keskustelut/2?7386</link>
	<description>Unix komentojen käyttö PHP:n avulla?</description>
	<pubDate>11:23 20.11.04</pubDate>
</item></channel>
</rss>
Comment 6 Jacek Kalinski 2004-12-20 20:56:09 UTC
Hello,
I also have a problem with pubDate...
Is there a posibility, to check "pubDate" tag in ignorecase? If the tag is "pubdate" there is displayed current date (not pubdate included in tag).
Comment 7 judit 2004-12-21 20:20:11 UTC
do u know what is the 502 error? thanks and answer please!
judith and aitzi
Comment 8 Frank Osterfeld 2005-01-06 23:37:53 UTC
CVS commit by osterfeld: 

Ignore pubdates we can't parse, instead of setting them to epoch (1970-01-01).
BUG: 92549


  M +14 -12    article.cpp   1.19
  M +7 -3      tools_p.cpp   1.10


--- kdepim/akregator/src/librss/article.cpp  #1.18:1.19
@@ -94,5 +94,6 @@ Article::Article(const QDomNode &node, F
     }
     
-        if (!(elemText = extractNode(node, QString::fromLatin1((format==AtomFeed)? "created": "pubDate"))).isNull()) {
+        if (!(elemText = extractNode(node, QString::fromLatin1((format==AtomFeed)? "created": "pubDate"))).isNull())
+    {
                 time_t _time;
                 if (format==AtomFeed)
@@ -100,16 +101,17 @@ Article::Article(const QDomNode &node, F
                 else
                    _time = KRFCDate::parseDate(elemText);
-                /* \bug This isn't really the right way since it will set the date to
-                 * Jan 1 1970, 1:00:00 if the passed date was invalid; this means that
-                 * we cannot distinguish between that date, and invalid values. :-/
-                 */
+
+        // 0 means invalid, not epoch (it returns epoch+1 when it parsed epoch, see the KRFCDate::parseDate() docs)
+        kdDebug() << "parsed: " << _time << endl;
+        if (_time != 0)
                 d->pubDate.setTime_t(_time);
         }
-        if (!(elemText = extractNode(node, QString::fromLatin1("dc:date"))).isNull()) {
+        if (!(elemText = extractNode(node, QString::fromLatin1("dc:date"))).isNull())
+    {
                 time_t _time = parseISO8601Date(elemText);
-                /* \bug This isn't really the right way since it will set the date to
-                 * Jan 1 1970, 1:00:00 if the passed date was invalid; this means that
-                 * we cannot distinguish between that date, and invalid values. :-/
-                 */
+
+        // 0 means invalid, not epoch (it returns epoch+1 when it parsed epoch, see the KRFCDate::parseDate() docs)
+        kdDebug() << "parsed: " << _time << endl;
+        if (_time != 0)
                 d->pubDate.setTime_t(_time);
         }

--- kdepim/akregator/src/librss/tools_p.cpp  #1.9:1.10
@@ -16,9 +16,13 @@
 time_t RSS::parseISO8601Date(const QString &s)
 {
+    // do some sanity check: 26-12-2004T00:00+00:00 is parsed to epoch+1 in the KRFCDate, which is wrong. So let's check if the date begins with YYYY -fo
+    if (s.stripWhiteSpace().left(4).toInt() < 1000)
+        return 0; // error
+
+    // FIXME: imho this is done in KRFCDate::parseDateISO8601() automatically, so we could omit it? -fo
         if (s.find('T') != -1)
                 return KRFCDate::parseDateISO8601(s);
-        QString time=s;
-        time += "T12:00:00";
-        return KRFCDate::parseDateISO8601(time);
+    else
+        return KRFCDate::parseDateISO8601(s + "T12:00:00");
 }
 


Comment 9 Vaidas Pilkauskas 2005-02-03 09:37:08 UTC
http://www.securityfocus.com/rss/news.xml
some dates are set to "1970 01 01 03:00"
Comment 10 atoms 2008-07-14 07:55:14 UTC
FYI I'm getting dates in the year 2100 for some reason!