Proposed new KDateTime class
David Jarvie
lists at astrojar.org.uk
Mon Nov 14 01:31:49 GMT 2005
On Friday 11 Nov 2005 15:14, Michaƫl Larouche wrote:
> David Jarvie wrote:
> > On Tuesday 08 Nov 2005 22:40, Nicolas Goutte wrote:
> >> On Tuesday 08 November 2005 23:00, David Jarvie wrote:
> >>> Now that the time zone classes have been updated, there is a need to be
> >>> able to handle date/times which have an associated time zone. I attach
> >>> a proposed new kdecore class, KDateTime, which represents a date/time
> >>> with an associated time zone. The aim is to make time zone handling as
> >>> automatic as possible when manipulating dates and times. Its interface
> >>> is very similar to QDateTime, but it is not inherited from QDateTime
> >>> mainly because QDateTime's methods are not virtual.
> >>>
> >>> The code compiles, but I until I finish the test program is untested.
> >>> Note that if the new class is committed, the time zone classes will
> >>> need to be amended to handle the new class.
> >>>
> >>> Comments please. (Note that I am going away and won't be able to
> >>> respond for a few days.)
> >>
> >> Do you plan something like QDateTime::toString and QDateTime::fromString
> >> for ISO dates, including time zone handling?
> >>
> >> (Also, I am not sure how flexible such functions need to be, I would
> >> need such them for KBabel saving and loading Gettext PO files.)
> >
> > Yes, it would be a good idea. There would need to be an extension to the
> > format codes to be able to specify where and in what format the time zone
> > should appear. I suggest that the default format would append the
> > abbreviated code for the time zone to the end of the string.
>
> A support of GLIBC time formatting
> (http://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time
>.html#Formatting-Calendar-Time) like the one used in strftime() would be a
> nice addition to this class.
There seems to be a choice between supporting GLIBC time formatting (with %
codes) and supporting an extension of the QDateTime::toString() formatting
(with codes which don't use %). Probably GLIBC formats are clearer, and they
already provide codes for time zones. But QDateTime formats provide better
compatibility with the QDateTime class. Both format styles could be
supported, but I doubt whether that would really be desirable. What are
people's preferences?
--
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/linux/kalarm.html
More information about the kde-core-devel
mailing list