I'm trying to set the system time to UTC such that when I log in and run date, or run programs that ask for the current time (say, python -c 'import datetime; print datetime.datetime.now()'), they return times in UTC. Based on searching and https://askubuntu.com/a/524362, I expect that when I run

sudo timedatectl set-timezone UTC

the system time will be set to UTC. That program exits with 0 when I run it and timedatectl status prints the following output:

$ timedatectl status
      Local time: Wed 2016-03-16 14:31:50 UTC
  Universal time: Wed 2016-03-16 14:31:50 UTC
        RTC time: Wed 2016-03-16 14:31:49
       Time zone: UTC (UTC, +0000)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

However, when I log out, log back in, and run date, I still get a value in EDT:

$ date
Wed Mar 16 10:31:32 EDT 2016

What am I doing wrong?

share|improve this question
    
That command sets your timezone to EDT. You also still have network (auto set) time on. – TheWanderer Mar 16 '16 at 14:48
    
@Zacharee1 I'm so sorry - copy/paste fail! I've updated the command to reflect what I actually ran on the machine. – Kevin Burke Mar 16 '16 at 15:43
    
I think it might be because of the automatic time setting. I'm not very experienced in this though. – TheWanderer Mar 16 '16 at 15:44

If you don't mind getting an interactive application,

$ sudo dpkg-reconfigure tzdata.

As to why the timedatectl failed, see the GUI time/date configuration option in System Settings. It is possible that some Use network time setting is blocking it.

Another alternative method is:

$ sudo ln -sf /usr/share/zoneinfo/Etc/GMT$offset /etc/localtime, where $offset is the offset from GMT(UTC) time. Since, you want UTC,

$ sudo ln -sf /usr/share/zoneinfo/Etc/GMT /etc/localtime.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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