Time different/wrong between GUI and CMD

Hi , thanks in advance for reading.

I have been having some odd issues, and they seem to be related to time. So I did some digging and found my clocks don’t match.

My gui clock says 7:09 12/29/2023. (KDE)

my terminal says Fri Dec 29 12:09:20 AM UTC 2023. (Konsole)

When writing a file, it says tomorrow @ 1:03 am. (Dolphin)

The gui time is correct.

Tumbleweed fully updated as of 1 hour ago.

How can I fix this? I am not sure where to even begin.

thanks!

@kilbert885 Set the BIOS time to UTC and ensure chronyd is running. If the system is dual boot with Windows then do the RealTimeIsUniversal registry tweak in Windows.

Provide output from:

ls -l /etc/localtime

echo $TZ

Maybe also use CTRL-ALT-F1 to get to a virtual console, and check the output from echo $TZ
You can get back to your GUI with CTRL-ALT-F2 or CTRL-ALT-F7 (depends somewhat on which software you are using for display-manager).

No, it does not say that (at least that is not what the image you posted says).

Assuming the previously posted image was correct, this is probably the same time, just in different time zone. Time in console in in UTC time. You did not say where you are located and what your time zone is. According to this image your local time seems to be 5 hours to the West of Greenwich.

@kilbert885

You probably need to read about date/time in Linux. The system time is (well, should be) in UTC and is in milliseconds since the Epoch. How it is represented to a user depends on the setting of the TZ evironment variable and there is a defaut setting for it, but every user can set his own value. It can even be set per process:

henk@boven:~> date
Fri Dec 29 09:36:48 CET 2023
henk@boven:~> TZ=UTC date
Fri Dec 29 08:36:58 UTC 2023
henk@boven:~> TZ=Asia/Kathmandu date
Fri Dec 29 14:22:27 +0545 2023
henk@boven:~> 

Ths you have to check what the setting is in that particular KDE session. You did not tell us how you started the CLI session. But when it simply is a started Konsole, it should show date/time based on the same TZ. Thus I assume your CLI session was another user, or on a console (or both).

ls -l /etc/localtime
lrwxrwxrwx 1 root root 36 Nov 9 2021 /etc/localtime → /usr/share/zoneinfo/America/New_York

I stated the CLI through Konsole, with the same user. All this is at the same time, same session, same user. Dolphin is the same user. Not sure how I can be writing files tomorrow when viewed in dolphin.

When I do the Echo $TZ it gives a blank line

3400g:~ # timedatectl 
               Local time: Fri 2023-12-29 14:58:07 CET
           Universal time: Fri 2023-12-29 13:58:07 UTC
                 RTC time: Fri 2023-12-29 13:58:08
                Time zone: Europe/Berlin (CET, +0100)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
3400g:~ # 

CHROnyd: Not sure how to check, but it is installed.

I fixed the time to match mine, and replaced the battery. The bios did not have a utc setting I could find, but I did change it to match. So far all clocks seem to be aligned.
thanks!

thanks!
Seems to be working.

Kilbert@Galactica:~> timedatectl
Local time: Fri 2023-12-29 09:14:27 EST
Universal time: Fri 2023-12-29 14:14:27 UTC
RTC time: Fri 2023-12-29 14:14:27
Time zone: America/New_York (EST, -0500)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no

Which is five hours west of Greenwich.

And in Konsole session you used date -u command. Are you aware what -u option does? If yes, I do not understand this topic at all. If no - why did you use this option in the first place?

That’s fine. That’s what to expect if $TZ is not set.

It is possible to have $TZ set to a timezone different from the system timezone. That’s what I wanted you to check.

Thnkas. all time match!