KDateTime: revised version

Nicolas Goutte nicolasg at snafu.de
Mon Nov 21 12:31:14 GMT 2005

On Monday 21 November 2005 03:14, David Jarvie wrote:
> Attached is revised code for a new KDateTime class. There are various minor
> changes in response to comments.
> It includes toString() and fromString() methods, as requested in previous
> comments. Note that because a UTC offset specified in a time string doesn't
> uniquely define a time zone (different time zones can have the same UTC
> offset at various times of the year, or simultaneously), fromString() can't
> necessarily do the reverse of toString(). The only way to unambiguously
> read a time with time zone is to have the time zone name included in the
> string, and for a KTimezones collection to be supplied in which to look up
> that time zone name. (Of course, a time zone can also be defined by a very
> long string giving details of all its time changes, etc., but that isn't a
> user readable thing which toString() would want to output.) This isn't
> ideal, but is AFAICS an inevitable restriction on what fromString() can do.
> Serialisation functions (operator>>(QTextStream&...) etc.) are not included
> because of the problems serialising KTimezone subclasses (see
> http://lists.kde.org/?l=kde-core-devel&m=113210232605956&w=2).
> The code doesn't quite compile yet, because it would require a new method
> in KTimezone ( utcOffsets() ) which I'll implement when necessary.
> Once it's been tested (via a qttestlib test program) and
> KTimezone::utcOffsets() has been added, is it now OK to commit?

Apart the license mismatch (Qt is GPL, kdelibs needs LGPL, BSD (without ad) or 
compatible) already pointed out by Simon Hausmann, I have a critic/wish about 
KDateTime::fromString in the Qt::TextDate version.

It would be nice if it would support time zones too, as RFC 2822 (section 3.3) 
permits timezones (and RFC 822 (section 5) seems to already allow them too). 
(RFC 2822 obsoletes RFC 822.)

I do not know how much the kdepim developers would need such a function (or 
may be already have it) but it would be surely better that such a function 
would be in kdelibs.

Have a nice day!

More information about the kde-core-devel mailing list