[Gambas-user] New component gb.rss to generate and parse RSS documents

Tobias Boege taboege at ...626...
Sun Apr 2 22:34:07 CEST 2017


On Sun, 02 Apr 2017, Benoît Minisini wrote:
> Le 02/04/2017 à 18:07, Tobias Boege a écrit :
> > Hello all,
> >
> > I wrote an RSS feed generator for one of my projects recently and could
> > luckily complete also the parser before the new semester starts tomorrow.
> > So you get a gb.rss component in the latest revision #8117.
> >
> > It should support all the things that are mentioned in the RSS 2.0
> > specification here [1], but there are still some problems:
> >
> >   * The date conversion routines ignore timezones completely, because
> >     I have no clue about working with timezones in Gambas.
> 
> As I don't know RSS, can you elaborate? What do you need to do exactly 
> with timezones?
> 

The items in an RSS feed (and the feed itself) contain publication dates
such as

  Sat, 07 Sep 2002 10:00:00 GMT

At the moment, when I read this string into a Date and use it in a Gambas
application, the timezone is ignored, i.e. it will be the 7th Sep 2002 at
10:00:00 *system-local timezone*, which is not correct. You can see this
when you serialise the RSS object into an XML document again. It gives:

  Sat, 07 Sep 2002 10:00:00 +0100

because my system is in +0100 now.

I don't know how this situation is best handled. The Gambas Date type is
not big enough to carry timezone information, is it? Then I would have to
convert the given time to the system timezone

  10:00:00 GMT -> 09:00:00 +0100

which results in the XML output

  Sat, 07 Sep 2002 09:00:00 +0100

later, which is not identical to the source but at least represents the same
point in time. But I could image that being able to set the target timezone
explicitly would be desirable, e.g. when your RSS feed item represents a
story in a German newspaper, but your server runs in a US timezone.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list