coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tests: date: check that the hour format of the current locale is use


From: Pádraig Brady
Subject: Re: tests: date: check that the hour format of the current locale is used
Date: Sun, 12 Oct 2025 13:02:01 +0100
User-agent: Mozilla Thunderbird Beta

On 12/10/2025 06:34, Collin Funk wrote:
This patch adds a test that the 'date' command uses the 12-hour clock or
24-hour clock depending on the current locale.

That test is testing the locale definitions as much as date(1),
so I suspect it would give false failures on various systems.

You could correlate with `date +"$(locale date_fmt)"` I suppose
(assuming `locale date_fmt` is supported by the system).

I suppose you could
Also, I noticed that 'date' uses nl_langinfo (_DATE_FMT). It appears that
_DATE_FMT is a glibc extension. Is there any reason that the
standardized D_T_FMT isn't used instead?

It looks better in my timezone (America/Los_Angeles) at least:

     $ export LC_ALL=en_US.UTF-8
     $ ./date-D_T_FMT
     Sat 11 Oct 2025 10:30:17 PM PDT
     $ ./date-_DATE_FMT
     Sat Oct 11 10:30:08 PM PDT 2025

With _DATE_FMT the year feels misplaced to me.

That's a question for glibc I think rather than coreutils
Collin

[1] https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/langinfo.h.html

There is some info about the 12/24 correlation at:
https://bugzilla.redhat.com/show_bug.cgi?id=1830623

cheers,
Padraig



reply via email to

[Prev in Thread] Current Thread [Next in Thread]