Diary SiteMap RecentChanges About Contact Calendar

Search:

Matching Pages:

BBC

I used to skim the world service RSS feed twice a week. That is not enough to even skim all the news. I ended up overwhelmed by the InformationOverload and dropped the feed. :/

2014-04-25

Comments

ehe news from 1905? Y2K bug in 2005?

PierreGaston 2005-04-26 09:05 UTC


Hehehe, I didn't even notice! In the RSS 2.0 feed I found:

    <pubDate>Tue, 26 Apr 05 07:44:29 GMT</pubDate>

I must check whether this is valid… It says: "All date-times in RSS conform to the Date and Time Specification of RFC 822, with the exception that the year may be expressed with two characters or four characters (four preferred)." [1] But which century would that be in – do you think RFC 822 will help us? It was written August 13, 1982. This is what it says:

     date        =  1*2DIGIT month 2DIGIT        ; day month year
                                                 ;  e.g. 20 Jun 82

I think using two digits is bad engineering. Now I have to fiddle with some stupid heuristics… Here is what I currently have:

	  my $date = $i->{dc}->{date};
	  if (not $date and $i->{pubDate}) {
	    $date = $i->{pubDate};
	    my %mon = (Jan=>1, Feb=>2, Mar=>3, Apr=>4, May=>5, Jun=>6,
		       Jul=>7, Aug=>8, Sep=>9, Oct=>10, Nov=>11, Dec=>12);
	    $date =~ s/^(?:[A-Z][a-z][a-z], )?(\d\d?) ([A-Z][a-z][a-z]) (\d\d(?:\d\d)?)/ # pubDate uses RFC 822
	      sprintf('%04d-%02d-%02d', ($3 < 100 ? 1900 + $3 : $3), $mon{$2}, $1)/e;
	  }

Maybe I should use:

	      sprintf('%04d-%02d-%02d', ($3 < 60 ? 2000 + $3 : ($3 < 100 ? 1900 + $3 : $3)), $mon{$2}, $1)/e;

Yuck!

AlexSchroeder 2005-04-26 09:28 UTC

Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Please say HELLO.

Show Google +1

EditNearLinks: PierreGaston