From: GOTO Masanori <[EMAIL PROTECTED]>
   Date: Thu, 30 Mar 2000 07:19:34 +0900

   I cannot [agree with] your opinion; "date" has always printed the
   time zone by default.

Sorry, I meant the original Unix tradition.  You're correct that
"date" is not required to print the time zone in non-POSIX locales,
though I cannot recommend omitting the time zone as this makes the
output ambiguous.  (Some day Japan may start using daylight-saving
time again; at that point you'll come to appreciate having a time zone
indicator by default.  :-)

    * If a system have locales and it is NOT used in the POSIX locale,
      it should display as d_t_fmt.

This isn't a good approach, as it conflates strftime's %c with the
output of "date".  Traditionally, they expanded to different strings,
and we shouldn't force them to be the same.

Solaris attacks this problem by having a localedef keyword date_fmt
that defines the output of date.  This is a better solution.  For
example, for the ja_JP.UTF-8 locale, Solaris 7 uses the following
definitions:

d_t_fmt         "%Y<U5E74>%m<U6708>%d<U65E5><space>%H<U6642>%M<U5206>%S<U79D2>"
era_d_t_fmt     "%EY%m<U6708>%d<U65E5><space>%H<U6642>%M<U5206>%S<U79D2>"
date_fmt        
"%Y<U5E74>%m<U6708>%d<U65E5><space><left-parenthesis>%a<right-parenthesis><space>%H<U6642>%M<U5206>%S<U79D2><space>%Z"

Here d_t_fmt corresponds to strftime %c,
era_d_t_fmt corresponds to strftime %Ec, and
date_fmt corresponds to the output of "date".
Only date_format has the time zone %Z.

As I mentioned earlier, glibc strftime could follow the Olson
library's lead and use %+ to generate date_fmt.  Another possibility,
which I didn't mention earlier, is to follow Solaris's lead, and to
have nl_langinfo (_DATE_FMT) return date_fmt.  An advantage of
_DATE_FMT is that it's easier for "date" to autoconfigure at
compile_time, even with cross-compiles.  The former approach is easier
to do at run-time, though, and this might be nice too, for some
applications.  Perhaps glibc should do both.

So I think a better way to way to fix this is:

  1.  Modify glibc localedef to support date_fmt as shown above.
      I assume that this can be done upward-compatibly,
      but I haven't checked this.

  2.  Modify glibc so that nl_langinfo (_DATE_FMT) returns date_fmt,
      and so that strftime %+ expands to date_fmt.

  3.  Modify GNU date to use nl_langinfo (_DATE_FMT) if available.

(3) is needed for the Solaris port of GNU sh-utils regardless of any
change to glibc, so I'll volunteer to do this and will send a patch to
the GNU date maintainer, with a CC: to you.

Can you do (1) and (2)?  Probably the documentation is the hardest part.

   The order of "%a %b %e %H:%M:%S %Z %Y" is correct in English,

No, actually, it's bad English too.  I'm a native-English speaker, and
I would never say a date and time in that order.

Reply via email to