Locales doesnt update correctly when setting time-zone

Changed time-zone from default to:

set system time-zone Europe/Stockholm

However when doing “show date” the output is:

Mon Jul 10 06:36:50 PM CEST 2023

Expected output is:

Mon 10 jul 2023 18:36:50 CEST

That is expected is 24h time instead of 12h time.

Compare output of “locale” between Ubuntu and VyOS 1.4 rolling (230710):

Ubuntu 22.10:

LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE=“en_US.UTF-8”
LC_NUMERIC=sv_SE.UTF-8
LC_TIME=sv_SE.UTF-8
LC_COLLATE=“en_US.UTF-8”
LC_MONETARY=sv_SE.UTF-8
LC_MESSAGES=“en_US.UTF-8”
LC_PAPER=sv_SE.UTF-8
LC_NAME=sv_SE.UTF-8
LC_ADDRESS=sv_SE.UTF-8
LC_TELEPHONE=sv_SE.UTF-8
LC_MEASUREMENT=sv_SE.UTF-8
LC_IDENTIFICATION=sv_SE.UTF-8
LC_ALL=

VyOS 1.4 rolling (230710):

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=“en_US.UTF-8”
LC_NUMERIC=“en_US.UTF-8”
LC_TIME=“en_US.UTF-8”
LC_COLLATE=“en_US.UTF-8”
LC_MONETARY=“en_US.UTF-8”
LC_MESSAGES=“en_US.UTF-8”
LC_PAPER=“en_US.UTF-8”
LC_NAME=“en_US.UTF-8”
LC_ADDRESS=“en_US.UTF-8”
LC_TELEPHONE=“en_US.UTF-8”
LC_MEASUREMENT=“en_US.UTF-8”
LC_IDENTIFICATION=“en_US.UTF-8”
LC_ALL=

I guess LC_TIME is involved in this.

I think the output is the expected one. You are just changing the timezone and not the locality used to modify output. There is no way to modify the locality at the moment as far as I know.

Hi @Apachez ,
I have checked Time Zone setting on:

  • VyOS 1.4-rolling-202307060317
  • VyOS 1.4-rolling-202306280317
    No problem found.

vyos@vyos# set system time-zone Europe/Stockholm
vyos@vyos# commit
vyos@vyos# exit
vyos@vyos:~$ show date
Tue Jul 11 07:31:21 AM CEST 2023
image

A system time zone must be specified, this can be done by either specifying the zone as Region/Location or as offset from UTC, the system’s default zone is GMT. When the Region/Location format is being used, daylight savings time (DST) adjustments are done automatically.

Again, your “show date” shows a 12h clock instead of the 24h which whole Europe is using.

24h is the proper way to display the digital time in Europe.

@Apachez many Linux based operation systems locale settings are currently set to a locale that specifies a 12-hour time format.
With typing locale we can view the current locale settings. Basically, all the locale settings are just environment variables, but there are some dependencies between them.
If we are using the default en_US.UTF-8 locale, then en_GB.UTF-8 would be the closest equivalent with 24-hour time representation. To set it, use:

localectl set-locale LC_TIME=en_GB.UTF-8

Then logout & log back in to have the change take effect in your session.
If you are unsure, you can test the output by specifying the desired locale as an environment variable for the date command:
Like:

LC_TIME=en_US.UTF-8 date
Tue Jul 11 04:46:10 PM +04 2023

LC_TIME=en_GB.UTF-8 date
Tue 11 Jul 16:46:14 +04 2023

I know how to set things in a linux box - done that for decades.

Problem here is that VyOS doesnt honor the selected timezone. As in when Europe/x is set then a 24h clock should be used instead of a 12h AM/PM clock.

Or if the VyOS team dont want to alter things in the background when a timezone is selected then the time-locate should have its own parameter to be set in config mode.

For example:

set system time-format 12h

vs.

set system time-format 24h

Default should be 24h due to ISO-standards. Would also match how many other routers/switches/firewalls out there by default displays current time.

One should NOT be forced to do things in the linux shell to make VyOS behave properly IMHO.

1 Like