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

d4t4full at ...626... d4t4full at ...626...
Mon Apr 3 00:48:06 CEST 2017


I do not see the need to "force" developers needing timezone handling  functionality to add a reference to gb.util.web; expecting to have timezone capability in a web component is simply not intuitive.

Couldn't the timezone be a new property of the Date type/object, defaulting to the System's timezone? This way older programs and interpreters ignoring it would still work.

An alternative would be to add an (optional) timezone pareter to DateAdd, and/or a new Format specifier for timezone. I do not have it present now, but if Gambas has Dateserial/Timeserial functions, they could too receive timezone as optional info.

Just my two cents.
zxMarce

On Apr 2, 2017, 17:40, at 17:40, "Benoît Minisini" <gambas at ...1...> wrote:
>Le 02/04/2017 à 22:34, Tobias Boege a écrit :
>> 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
>>
>
>Date in Gambas are storead as a number of days and microseconds from a
>specific origin, and are always considered as UTC.
>
>They are converted to the timezone associated with the localisation
>when
>you use Str() or Format() or Print.
>
>To convert a date ti a specific timezone, you have to convert the date
>part taken as UTC, and then you add (or substract I think, must be
>checked!) the time zone value (which are hours).
>
>Maybe this is an utility function to implement in gb.util.web...
>
>--
>Benoît Minisini
>
>------------------------------------------------------------------------------
>Check out the vibrant tech community on one of the world's most
>engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>_______________________________________________
>Gambas-user mailing list
>Gambas-user at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/gambas-user



More information about the User mailing list