[Kde-pim] format date and includeSeconds

David Jarvie djarvie at kde.org
Mon Jul 28 13:54:09 BST 2008

On Monday 28 July 2008 13:07, Carles Pina i Estany wrote:
> On Jul/28/2008, David Jarvie wrote:
>> On Friday 25 July 2008 21:08, Carles Pina i Estany wrote:
>> > I have a small issue in KMail, and tracing it I got to the file:
>> > kdelibs/kdecore/localization/klocale.cpp
>> >
>> > "Problem": when kmail has a mail with this date (checking the
>> headers):
>> > Date: Sun, 6 Jul 2008 15:54:45 +0200
>> > (for example)
>> >
>> > In the kmail standard view I get this date:
>> > 06-07-08 15:54
>> >
>> > In my opinion it should say 15:55, not 15:54.
>> I'd say that the first thing to discuss is whether it _should_ say 15:55
>> instead of 15:54, and that discussion should be on the kde-pim list, not
>> kde-core-devel. I wouldn't normally expect rounding to be applied to
>> times, so if any rounding needs to be done, IMHO it should be done by
>> KMail before calling the function in klocale.cpp.
> I'm not engaged with kde-pim or kde-core -devel projects (I'm just a
> kmail user)
> (Well, I have a testing patch for kde-core that I wanted to finish
> tonight, but now I will wait for the discussion)
> kde-core is who is receiving the full time and making it "fancy" or
> changing the format from RFCXXXX to userfriendly string, following the
> local.  This function[1] has a includeSeconds to write or not write the
> seconds for the user-friendly format, and some other stuff.
> In my opinion, is the responsability of this function and layer to
> return as best time is possible.

The best time has to depend on the application's requirements. In KAlarm,
for example, I'd always want times to be truncated, never rounded up.
There are two ways of doing this: either the application can do any
rounding itself before using the klocale function, or the klocale function
would need an extra option to allow the caller to choose whether to round
or truncate.

David Jarvie.
KAlarm author & maintainer.

More information about the kde-core-devel mailing list