This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

LC_TIME: date_fmt vs d_t_fmt


the `date` command will default to the LC_TIME.date_fmt field.  it does
this by looking up nl_langinfo(_DATE_FMT) (iff _DATE_FMT is defined).
if that isn't available, it falls back to the default:
	%a %b %e %H:%M:%S %Z %Y
this is required by POSIX for the POSIX locale, but works generally too.
	http://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html#tag_20_30_10

the GNU coreutils date code lives here (as does all this logic):
	http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/date.c

the LC_TIME.date_fmt was first added to glibc here:
	https://sourceware.org/ml/libc-alpha/2000-10/msg00298.html
	https://sourceware.org/git/?p=glibc.git;a=commit;h=d8337213c83c3bd4aa32e16669745dd7ee32b329

it quoted the XPG4 standard for the background.  i haven't been able to
locate that old standard, but all the ones i do have access to (SuSv2
and newer) do not mention _date_fmt or date_fmt anywhere that i can find.

we get a steady stream of complaints (some in our bugzilla, but via other
sources as well like the mailing list or distro users) that the output of
`date` does not match their expectations.  in the end, they end up saying
that want something that looks very much like `date +%c` which is what the
LC_TIME.d_t_fmt field is set to.

so what should we do here ?  we provide 0 guidance to locale writers which
means we get inconsistent behavior across locales.  options:
(1) punt date_fmt entirely (so `date` uses the POSIX default everywhere)
(2) change date_fmt internally to always return %c
(3) try to clearly define the difference between date_fmt and d_t_fmt --
    anyone know what that is ?  or have access to the XPG4 definition ?
(4) somethine else ?
-mike

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]