Subject: Re: strftime %X control: how?
To: NetBSD User-Level Technical Discussion List <tech-userlevel@NetBSD.org>
From: Greg A. Woods <woods@planix.com>
List: tech-userlevel
Date: 07/06/2007 15:05:13
--pgp-sign-Multipart_Fri_Jul__6_15:05:02_2007-1
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?
>=20
> 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:

    http://www.opengroup.org/onlinepubs/007908799/xbd/locale.html

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.
>=20
> 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.

--=20
						Greg A. Woods

H:+1 416 218-0098 W:+1 416 489-5852 x122 VE3TCP RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>       Secrets of the Weird <woods@weird.com>

--pgp-sign-Multipart_Fri_Jul__6_15:05:02_2007-1
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

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

iQA/AwUBRo6SXmZ9cbd4v/R/EQKluACdE2DRJ5T1laIX9aPas9vzFQUsB9oAn31+
uw+GOglK2lRR5z+O5F8nIXRp
=7Boe
-----END PGP SIGNATURE-----

--pgp-sign-Multipart_Fri_Jul__6_15:05:02_2007-1--