Review Request: Add more date formatting options
John Layt
johnlayt at googlemail.com
Mon Nov 16 16:02:59 GMT 2009
On Sunday 15 November 2009 21:00:00 Melchior FRANZ wrote:
> * John Layt -- Sunday 15 November 2009:
> > %t a tab character
>
> I'd leave that away. A tab is a constant, usually represented by \t.
> There's no reason to treat it like a date placeholder. This would be
> unexpected and inconsistent with the rest of the computer universe.
>
> m.
>
Oh, I beg to differ :-) It is actually part of the C, POSIX and Common UNIX
standards in the definitions for LC_TIME, the strftime(), wcsftime(), and
strptime() functions and the date utility, and as such is implemented in GNU
and glibc:
http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html
http://www.opengroup.org/onlinepubs/009695399/utilities/date.html
So it is consistent with a very large part of the computer universe :-)
Perhaps I should give some short background for why I've added this change.
There's two reasons, one is to provide more options for our app programmers
and users (ISO standard format compliance is a Good Thing), the other is to
improve cross-platform compatibility.
If you run a KDE app under Windows, OSX, Gnome, or any other desktop than KDE,
then the app still tries to use the KDE locale rather than the desktop locale,
which previous discussions have concluded it should use where possible to fit
in properly. This is particularly a problem if the user has never chosen
their locale in KDE, so they get the US default rather than an intelligent
fallback (separate patch for that to come).
In KDE4.5 I'm planning to have pluggable KLocale backends for each platform,
so if you're running under Windows you get the Windows desktop date formats,
and if you're running under Gnome or XFCE you get their date formats which I
understand are all based on the standard LC_* environment variables. So we
need to be able to read the LC_TIME format and format our dates to that
standard (or link to glibc to do it for us, not an option!).
So, it may not be nice, but it is standard, and we will need to support it in
4.5 if my plans work out. My change is still not 100% standard compliant, but
those will come in 4.5.
John.
More information about the kde-core-devel
mailing list