[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#217224: libc6-dev: strftime can not return locale-compliant time string without seconds



Package: libc6-dev
Version: 2.3.2-8
Severity: wishlist

In a program I was developing, I had the need to represent time in a
localized fashion. Since the program in question deals with start and
stop times of television programmes, it makes no sense to clutter the
interface by specifying which second the programme starts on.

I attempted to use strftime(), but I could only find %X, which returns
the preferred time representation for the current locale, without the
date. It returns hours, minutes, and seconds on all locales I tested
this on.

There is also %R and %r, but for one using them is to ignore any
12/24-hour preference in the locale. (I'm assuming such a property
exists.) They also ignore the preferred seperator between the hours and
the minutes part. In Swedish, for example, we prefer to seperate hours
and minutes with a . -- so the appropriate formatting for Swedish would
be "16.45", for example, while %R would return "16:45".

I'm not a native speaker of the French language, but I am told they use
the convention "16h45" in situations such as this. I'm sure there are
many other examples of separator characters. Also, different languages
have different conventions for whether leading zeroes should be used
before single-digit hours, and whether a 12 hour or a 24 hour convention
should be used.

For this reason, I suggest that a new format be added that displays the
time in a representation suitable for the particular locale, but without
seconds.

Of course, as with any new feature in libc, the feature can't be used
safely without breaking backward-compatibility. Still, it's better to be
late than never adding a feature such as this.

In the meantime, I have decided to use gettext to allow translators to
compose their own format strings in the program I'm developing.

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux tanya 2.4.20 #1 m�mar 31 19:30:02 CEST 2003 i686
Locale: LANG=sv_SE.UTF-8, LC_CTYPE=sv_SE.UTF-8

Versions of packages libc6-dev depends on:
ii  libc6                         2.3.2-8    GNU C Library: Shared libraries an

-- no debconf information




Reply to: