You are not logged in.

#1 2021-12-02 10:21:29

gaterra
Member
Registered: 2021-12-02
Posts: 5

[SOLVED] date and timedatectl give different results for time

I recently changed where I live from a timezone in US EST (-4) to CET (+1).

I've changed my system time following the instructions here: https://wiki.archlinux.org/title/System_time#Time_zone/

I also attempted to adjust my locale to be appropriate for where I am currently living by uncommenting the appropriate lines in /etc/locale.gen, generating the locales, adjusting /etc/locale.conf, and rebooting.

However, when I run:

date

I get

jue 02 dic 2021 05:11:50 EST

(Thurs, 2 December)

and when I run

timedatectl

I get:

               Local time: jue 2021-12-02 11:11:47 CET
           Universal time: jue 2021-12-02 10:11:47 UTC
                 RTC time: jue 2021-12-02 10:11:47
                Time zone: Europe/Madrid (CET, +0100)
System clock synchronized: yes
              NTP service: inactive
          RTC in local TZ: no

When I use applications like Firefox, Discord, etc they show my time as if it were EST not CET. I'd like them to receive my time as CET. The result in Local Time from timedatectl is what I'd like.

Have I set my system time incorrectly?

Last edited by gaterra (2021-12-10 08:55:31)

Offline

#2 2021-12-02 11:35:49

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,206

Re: [SOLVED] date and timedatectl give different results for time

What are your current locale settings?

locale
locale -a
localectl

are you using a desktop environment? They often have their own locale settings that potentially override other system level settings you've done and you'd need to adjust in the appropriate settings tool.

Last edited by V1del (2021-12-02 11:36:49)

Offline

#3 2021-12-02 14:02:25

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,805

Re: [SOLVED] date and timedatectl give different results for time

There's also a chance that you're somewhere (shell rc, /etc/profile/*) exporting TZ=EST?

Offline

#4 2021-12-03 10:12:13

gaterra
Member
Registered: 2021-12-02
Posts: 5

Re: [SOLVED] date and timedatectl give different results for time

V1del wrote:

What are your current locale settings?

locale
locale -a
localectl

are you using a desktop environment? They often have their own locale settings that potentially override other system level settings you've done and you'd need to adjust in the appropriate settings tool.

Thanks for the help, here's what I have

locale
LANG=es_ES.UTF-8
LC_CTYPE="es_ES.UTF-8"
LC_NUMERIC="es_ES.UTF-8"
LC_TIME="es_ES.UTF-8"
LC_COLLATE="es_ES.UTF-8"
LC_MONETARY="es_ES.UTF-8"
LC_MESSAGES="es_ES.UTF-8"
LC_PAPER="es_ES.UTF-8"
LC_NAME="es_ES.UTF-8"
LC_ADDRESS="es_ES.UTF-8"
LC_TELEPHONE="es_ES.UTF-8"
LC_MEASUREMENT="es_ES.UTF-8"
LC_IDENTIFICATION="es_ES.UTF-8"
LC_ALL=
locale -a
C
en_US.utf8
es_ES.utf8
gl_ES.utf8
POSIX
localectl
   System Locale: LANG=es_ES.UTF-8
                  LANGUAGE=en_US.UTF-8
       VC Keymap: n/a
      X11 Layout: n/a


I am currently using qtile as a desktop environment. When I moved a couple months ago, I went in and manually changed the timezone the clock module on the bar uses in my config file, so it gives  me the correct time.

Offline

#5 2021-12-03 10:17:04

gaterra
Member
Registered: 2021-12-02
Posts: 5

Re: [SOLVED] date and timedatectl give different results for time

seth wrote:

There's also a chance that you're somewhere (shell rc, /etc/profile/*) exporting TZ=EST?

Thanks as well, I haven't found anything, but here's what I tried. Would this show me what you were thinking if it was the issue?

ls /etc/profile*
/etc/profile

/etc/profile.d:
freetype2.sh  gawk.sh  libreoffice-fresh.csh  locale.sh    perlbin.sh  vte.sh
gawk.csh      gpm.sh   libreoffice-fresh.sh   perlbin.csh  vte.csh

Both of the following give blank output:

cat /etc/profile | grep TZ
cat /etc/profile.d/* | grep TZ

Last edited by gaterra (2021-12-03 10:18:04)

Offline

#6 2021-12-03 10:36:19

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,805

Re: [SOLVED] date and timedatectl give different results for time

Let's check what actually is set:

tr '\0' '\n' < /proc/$(pidof qtile)/environ

Offline

#7 2021-12-07 10:11:18

gaterra
Member
Registered: 2021-12-02
Posts: 5

Re: [SOLVED] date and timedatectl give different results for time

seth wrote:

Let's check what actually is set:

tr '\0' '\n' < /proc/$(pidof qtile)/environ

Thanks Seth, here's the output:

SHELL=/bin/bash
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
DESKTOP_SESSION=qtile
GPG_TTY=no es un `tty'
GTK_MODULES=canberra-gtk-module
XDG_SEAT=seat0
PWD=/home/terrasa
XDG_SESSION_DESKTOP=qtile
LOGNAME=terrasa
XDG_SESSION_TYPE=x11
XAUTHORITY=/home/terrasa/.Xauthority
TZ=America/New_York
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/terrasa
TERMINAL=termite
MOTD_SHOWN=pam
HOME=/home/terrasa
LANG=es_ES.UTF-8
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
TERM=xterm-256color
USER=terrasa
DISPLAY=:0
SHLVL=0
XDG_VTNR=7
XDG_SESSION_ID=2
XDG_RUNTIME_DIR=/run/user/1000
GTK3_MODULES=xapp-gtk3-module
PATH=/home/terrasa/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/terrasa/Scripts
GDMSESSION=qtile
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
MAIL=/var/spool/mail/terrasa

Here it seems like TZ but I'm not isure where it's getting set.


Thanks again, sorry was AFK for the weekend.

Offline

#8 2021-12-07 10:19:02

Fixxer
Member
From: Poland
Registered: 2011-08-29
Posts: 232

Re: [SOLVED] date and timedatectl give different results for time

Post output of command:

ls -lah /etc/localtime

NTP service: inactive

Consider to start using eg. systemd-timesyncd (best results with local, gov timeservers).

Offline

#9 2021-12-07 10:33:42

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,805

Re: [SOLVED] date and timedatectl give different results for time

We already estblished that the OP has a stry $TZ exported somewhere.

It's either in the qtile or lightdm configuration/session wrapper.
Check the environment of the lightdm process to see whether the TZ is already set there. If not, it's either the session werapper script or qtile configuration.

Offline

#10 2021-12-07 11:35:22

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,060

Re: [SOLVED] date and timedatectl give different results for time

Fixxer wrote:

Post output of command:

ls -lah /etc/localtime

NTP service: inactive

Consider to start using eg. systemd-timesyncd (best results with local, gov timeservers).

Don't enable or start systemd-timesyncd .

               Local time: jue 2021-12-02 11:11:47 CET
           Universal time: jue 2021-12-02 10:11:47 UTC
                 RTC time: jue 2021-12-02 10:11:47
                Time zone: Europe/Madrid (CET, +0100)
System clock synchronized: yes
              NTP service: inactive
          RTC in local TZ: no

A synchronized system clock combined with timedatectl reporting ntp service inactive means user already has  working time synchronization setup correctly using some non-systemd service.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#11 2021-12-07 19:06:49

Fixxer
Member
From: Poland
Registered: 2011-08-29
Posts: 232

Re: [SOLVED] date and timedatectl give different results for time

A synchronized system clock combined with timedatectl reporting ntp service inactive means user already has  working time synchronization setup correctly using some non-systemd service.

No. I've checked it now with chronyd.

Last edited by Fixxer (2021-12-07 19:07:49)

Offline

#12 2021-12-07 19:31:39

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,805

Re: [SOLVED] date and timedatectl give different results for time

No "what"?

"A synchronized system clock"?
"timedatectl reporting ntp service inactive"?
"setup correctly using some non-systemd service"?

I'm unsure how activating chronyd could disprove lone_wolf's claim - even in theory.

Offline

#13 2021-12-10 08:54:23

gaterra
Member
Registered: 2021-12-02
Posts: 5

Re: [SOLVED] date and timedatectl give different results for time

I ended up finding it. I think seth was right.

I found a rouge TZ export in my ~/.profile

cheers

Offline

#14 2024-10-02 11:42:08

electronicsguy
Member
Registered: 2015-03-15
Posts: 1
Website

Re: [SOLVED] date and timedatectl give different results for time

seth wrote:

There's also a chance that you're somewhere (shell rc, /etc/profile/*) exporting TZ=EST?

Thank you! this was it, for me on my Ubuntu desktop. I was going crazy, trying to understand why I'm not able to get the updated time to show up on the Ubuntu status bar, when everything else looked fine.

Offline

#15 2024-10-03 08:27:54

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,060

Re: [SOLVED] date and timedatectl give different results for time

Glad you solved your issue with the info from this thread, but it's almost 3 years old.

Please read https://wiki.archlinux.org/title/Genera … bumping%22

Closing .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB