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

Re: Output from date command defaults to 12-hour in Buster.



On Wed, Apr 29, 2020 at 09:11:05AM +0300, Reco wrote:
> If you need it systemwide, consider doing this (will require relogin, at
> least):
> 
> echo 'LC_TIME=C' >> /etc/default/locale

I do not recommend hard-coding locales system-wide.  Individual users
should be free to set their own environments.

> If you need it for your user only (will require a new terminal emulator), 
> 
> echo 'LC_TIME=C' >> ~/.bashrc

You'll need to export it, in order for it have any effect on external
commands (like date).

The choice of .bashrc may be fine for GNOME users (hell, it may even be
*mandatory* for GNOME users, because GNOME is user-unfriendly shit),
but even then, it only affects commands that are launched from an
interactive shell.

In order to take effect in commands that are launched by the window
manager, or whatever, environment changes should be done much earlier
in the session.

For shell logins, you would want to put the command(s) in ~/.profile or
whatever your login shell's equivalent dot file is.

For GUI logins that are not GNOME, you can try setting up the environment
in ~/.xsessionrc -- but note that your Desktop Environment (even if it's
not GNOME) may overwrite whatever you try to set.

If it's GNOME, well, you're screwed.  GNOME has its own idea of how to
set up the user's locale, and it does not include such subtle concepts as
"use one locale for most things, but fine-tune LC_COLLATE and LC_TIME".
This has come up in the past on this mailing list, and there is no known
solution to it (other than "don't use GNOME").


The last time the "date in buster" issue came up, I experimented with
a customized locale -- see my write-up at
<https://www.mail-archive.com/debian-user@lists.debian.org/msg741047.html>
or whatever list archive Google happens to choose for you.

Since that time, I abandoned that approach.  It's too clunky in real
life -- too much trouble, too many opportunities for something to go
wrong, e.g. the environment variable doesn't get set where it needs
to be set, or *does* get set where it shouldn't, like inside a chroot
or similar encapsulation.

I just went with the LC_TIME=C approach instead.


Reply to: