2

I realize that this is a common issue, but I can't find the fix to my problem.

Live in "America/Chicago (CST, -0600)" but ubuntu is showing UTC time.

It is 4pm local time here:

$ timedatectl  
                      Local time: Thu 2018-11-22 16:11:47 CST  
                  Universal time: Thu 2018-11-22 22:11:47 UTC  
                        RTC time: Thu 2018-11-22 22:11:47  
                       Time zone: America/Chicago (CST, -0600)  
       System clock synchronized: yes  
 systemd-timesyncd.service active: yes  
                 RTC in local TZ: no  

So TimeDateCtl knows local time, but the Date command is showing me UTC

$ date
Thu Nov 22 22:15:54 Chicago 2018

I have made sure that the BIOS time is UTC, and my service is started up, just wrong.

● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2018-11-22 22:07:07 Chicago; 9min ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 1360 (systemd-timesyn)
   Status: "Synchronized to time server 91.189.89.199:123 (ntp.ubuntu.com)."
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/systemd-timesyncd.service
           └─1360 /lib/systemd/systemd-timesyncd

What else do I try? I set it to local time and back, I've restarted every service I can find.

Edit, I don't see a problem here either:

sudo hwclock --debug

hwclock from util-linux 2.31.1
System Time: 1542925579.769423
Trying to open: /dev/rtc0
Using the rtc interface to the clock.
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2018/11/22 22:26:20
Hw clock time : 2018/11/22 22:26:20 = 1542925580 seconds since 1969
Time since last adjustment is 1542925580 seconds
Calculated Hardware Clock drift is 0.000000 seconds
2018-11-22 22:26:19.764979+0000
  • Do you have the TZ environment variable set? Check the output of echo $TZ. That variable would override the timezone date shows, but not what timedatectl reports. – Byte Commander Nov 22 '18 at 22:24
  • Deleted the last comment because it was irrelevant. Fixed, thank you. TZ variable. – Chris948 Nov 22 '18 at 22:54
2

Your environment variable TZ is the cause of the problem.

$ echo $TZ
Chicago/New_York

Chicago/New_York is an invalid time zone, so date will default to UTC instead, but for some reason still display the first part of the zone name as time zone, resulting in:

$ timedatectl  
                      Local time: Thu 2018-11-22 16:11:47 CST  
                  Universal time: Thu 2018-11-22 22:11:47 UTC  
                        RTC time: Thu 2018-11-22 22:11:47  
                       Time zone: America/Chicago (CST, -0600)  
       System clock synchronized: yes  
 systemd-timesyncd.service active: yes  
                 RTC in local TZ: no  

$ date
Thu Nov 22 22:15:54 Chicago 2018

Now to fix the issue, we just need to find out where that wrong value is set and delete the line. Search for something like one of the lines below in your shell/profile initialization scripts, like ~/.profile, ~/.bashrc or if it affects all users maybe even /etc/environment, /etc/profile, /etc/profile.d/* or /etc/bash.bashrc:

TZ='Chicago/New_York'
export TZ='Chicago/New_York'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.