Hi Dario, Adam, list,
Adam Borowski writes:
> On Tue, Mar 30, 2021 at 06:37:44PM +0200, Dario Niedermann wrote:
>> `date` suddenly tells the time in 12-hour format, regardless of $TZ
>> (be it empty or 'Europe/<anything>').
>>
>> Who told it to do that? I certainly didn't.
>>
>> I had already noticed this before the recent switch to DST.
>
> I bet your locale is set to en_US.
>
> This setting is used for two unrelated things:
> * the default locale for anyone who wants English and doesn't live in
> Britfain or Down Under.
> * inhabitants of a silly land to the left of a pond to the left of Europe
>
> The latter have weird customs like a medieval system of measurements, units
> that differ on dry-vs-liquid-vs-slightly-moist, or different distances by
> the same name on air vs land vs survey measurements.
>
> And, also, a discontinuous system of time with four non-monotonic segments
> and ambiguous endpoints; marked with "am" and "pm".
Actually, I believe interpretation of the endpoints is locale dependent,
so your 12am might be someone else's 0pm. Or was that 0am the next day?
This kind of confusion made me use a 24-hour clock (aka "military time).
# While I'm "ranting", I also mightily dislike times for events show in
# local timezones. Even with the timezone indication I'm clueless more
# often than not and DST makes matter even worse. Why can't organizers
# simply use UTC? That one everyone only needs to know the conversion
# to their own timezone rather than being aware of 24 timezones and the
# various DST idiosyncracies.
# Just look at how often the `tzdata` package gets updated ...
> So in Buster (and thus Beowulf and Chimaera), meaning of "en_US" changed to
> include that silly 12-hour time.
>
> Ways to fix include:
> * C.UTF-8
> * en_DK.UTF-8 (for some reason, only Denmark is available -- but it's
> identical for all ways that matter)
I have a habit of selecting "C (No localization)" in the installer and
later installing the locales package. After that a
dpkg-reconfigure locales
will "fix" my system. I select `en_GK.UTF-8` and `ja_JP.UTF-8` (and
sometimes `nl_NL.UTF-8` too) to be generated and make `C.UTF-8` the
system default.
My reasoning being that the system administrator should be fluent in
C.UTF-8 and all my users (that's only me, mostly ;-) smart enough to
configure their sessions to taste. For my own, that's usually
export LANG=ja_JP.UTF-8
export LC_MESSAGES=en_GB.UTF-8
export LC_COLLATE=C.UTF-8
as I prefer an English UI but want sorting to honour non-alphanumerics
and put uppercase before lowercase when I `ls -a` :-P
BTW, in terms of available `en_*.UTF-8` locales
$ grep en_ /etc/locale.gen | grep UTF-8
# en_AG UTF-8
# en_AU.UTF-8 UTF-8
# en_BW.UTF-8 UTF-8
# en_CA.UTF-8 UTF-8
# en_DK.UTF-8 UTF-8
en_GB.UTF-8 UTF-8
# en_HK.UTF-8 UTF-8
# en_IE.UTF-8 UTF-8
# en_IN UTF-8
# en_NG UTF-8
# en_NZ.UTF-8 UTF-8
# en_PH.UTF-8 UTF-8
# en_SG.UTF-8 UTF-8
# en_US.UTF-8 UTF-8
# en_ZA.UTF-8 UTF-8
# en_ZM UTF-8
# en_ZW.UTF-8 UTF-8
# en_IL UTF-8
# en_SC.UTF-8 UTF-8
so there's a whole pile more than en_DK.UTF-8 but I have no idea (nor am
I inclined to find out) how these format date/time. When I really care
about the formatting I often use
date +%FT%T
or
date +'%F %T'
for ISO-8601 compliant formatted output. Personally, I find the latter
more readable but it kind of sucks in file names :-)
Of course, `date --iso-8601=seconds` will work too and will even include
timezone info. For UTC, just pass the `--utc` (or `-u`) option.
Hope this helps,
--
Olaf Meeuwissen, LPIC-2 FSF Associate Member since 2004-01-27
GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13 F43E B8A4 A88A F84A 2DD9
Support Free Software https://my.fsf.org/donate
Join the Free Software Foundation https://my.fsf.org/join