3

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?

1
  • I think it might be because of the automatic time setting. I'm not very experienced in this though. Mar 16, 2016 at 15:44

1 Answer 1

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .