Friday, 17 December, 2004

More on timestamp formats

Continuing yesterday's entry about syndication format dates...

As it turns out, the Atom syndication format draft specification uses a W3C date time value, which includes a UTC offset specifier, and Atom implementations apparently store the offset along with the date.  RSS 2.0 uses the RFC822 format.  RSS 1.0 (also known as RDF) doesn't define a date field as part of the core specification.  RSS 1.0 implementations that do implement a date field seem to be split on which of the two formats to use.  The information is there.  We just need to get implementors to use it.

I've recently downloaded two open source packages for working with syndication formats in C#:  RSS.NET and ATOM.NET.  Interestingly, both fail to parse the date and time stamps.  Why?  Because they rely on the .NET Framework's DateTime.Parse method, which doesn't understand those formats.  I've submitted a fix to the maintainer of RSS.NET, and will be submitting a fix to the ATOM.NET project as soon as I finish it.

I was surprised to encounter these bugs, especially in ATOM.NET.  DateTime.Parse says that it handles RFC822 format dates, but it only supports a subset of that format.  I can understand how a "quick test" of the code against a few RSS feeds would let that bug slip by.  But ATOM.NET uses the W3C date time value, and DateTime.Parse doesn't even come close to parsing that.  The author either didn't test that part of the code, or decided to release the code with the bug undescribed.  Shoddy work, that.