Subject: Re: strftime %X control: how?
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Greg A. Woods <>
List: tech-userlevel
Date: 07/05/2007 17:28:38
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

At Thu, 5 Jul 2007 14:03:21 -0400 (EDT), der Mouse wrote:
Subject: strftime %X control: how?
> Normally I run with nothing locale-specific in my environment, which I
> think means I get the C locale.


> But this means that atq prints dates as xx/xx/xx, which is horrible.  I
> want standard ISO date format, but I otherwise want what I have now.
> My question is, how can I get this?

I don't think you can, yet.  From setlocale(3)'s BUGS in everything up
to at least netbsd-4:

     The current implementation supports only the "C" and "POSIX"
     locales for all but the LC_CTYPE locale.

Indeed the code for setlocale(3) in netbsd-4 shows that nothing is done
for LC_TIME, and there are no specifications for LC_TIME features in

> After a little digging, it appears to me that I need to set $LC_TIME,
> but I haven't found any clue what to set it to.  Am I missing
> something, or is there just no way to get standard dates out of %X at
> present?

Further noted in setlocale(3):

	LC_NUMERIC and LC_TIME are personal choices and should
     not be wrapped up with the other categories.

P1003.2/D11.2 said:

    at          The at and cron family of utilities were omitted because
                portable applications could not rely on their behavior.

however the Single UNIX Specification v2 documents "at -l" as using
LC_TIME to "determine the format and contest for date and time strings

Personally I don't think it should be possible to personalize the date
formats used in standard reports produced by command-line tools.  They
should always be in the most appropriate standard format regardless of
locale.  E.g. strftime("%F-%T%z");

						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: mKrcRz6LFKpqNb/XY05p6hI3M1W3o8h8