KDateTime: revised version

David Jarvie lists at astrojar.org.uk
Mon Nov 21 02:14:13 GMT 2005


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?

-- 
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/linux/kalarm.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdatetime.cpp
Type: text/x-c++src
Size: 36468 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20051121/cb95cbb2/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdatetime.h
Type: text/x-c++hdr
Size: 21522 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20051121/cb95cbb2/attachment.h>


More information about the kde-core-devel mailing list