Subject: Re: strftime %X control: how?
To: NetBSD User-Level Technical Discussion List <>
From: Greg A. Woods <>
List: tech-userlevel
Date: 07/06/2007 15:05:13
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

At Thu, 5 Jul 2007 20:04:12 -0400 (EDT), der Mouse wrote:
Subject: Re: strftime %X control: how?
> Are there standards for what goes in $LC_TIME (or, what it points to,
> if it's just a name pointing to data somewhere else)?  If so, where can
> I find them?  If not, any thoughts on how to construct such a thing?

There are some constants in <langinfo.h> which can be used to pass to
nl_langinfo(3) which should then return a pointer to the relevant string
based on the current locale.  strftime(3) and similar functions should
of course be using this to retrieve the appropriate replacement
formatting strings for %X, %x, etc.

nl_langinfo() would retrieve this information from a locale definition
created by a utility that SuSv2 calls "localedef".  The source for those
definitions have a standard syntax and semantics defined here:

Of course none of this stuff is available integrated into any NetBSD
release yet.

> > Personally I don't think it should be possible to personalize the
> > date formats used in standard reports produced by command-line tools.
> I disagree.  It would be reasonable to provide a way to get some
> standard format, but for something like atq which is primarily intended
> for human consumption, letting humans configure it is Good.

I'm not sure that localization should apply to timestamps and date
formats (I am of course ignoring P1002.3 et al when I say that).  The
apparent goal of ISO-8601 was to define an international standard way
that dates and times could be presented without having to resort to
silly local prejudices.

Of course a portable P1003-compatible application which intends to
invoke "at -l" (or "atq") and do something more than just copy its
output, could, and should, set LC_ALL=3D$LANG and LC_CTIME=3DPOSIX in
the environment first in order to get parsable dates yet still have
messages appear in the invoking user's desired language.

						Greg A. Woods

H:+1 416 218-0098 W:+1 416 489-5852 x122 VE3TCP RoboHack <>
Planix, Inc. <>       Secrets of the Weird <>

Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

Version: PGPfreeware 5.0i for non-commercial use
MessageID: xs9fms57opc4muZ6pt97IkXVayi6NEaK