0

I want to be able to set timezone for Ubuntu hosts, from command line (given in POSIX format). I was searching for options, and found timedatectl from systemd package but since I did not want the entire systemd, but just timedatectl, I downloaded the .deb package and extracted the timedatectl binary, but that expects GLIBC>=2.17, I have GLIBC 2.15 on my Ubuntu 12.04 !

Is there any other utility, which is simple enough to use, that I can install, to set timezone in POSIX format (e.g. EST+10)

3
  • I'm on 14.04 , and I use timedatectl without systemd. In 14.04 the init system is still upstart so . . . Seems like you can use it without systemd. – Sergiy Kolodyazhnyy May 12 '15 at 13:32
  • 2
    @Serg most of the systemd stack can be used without systemd as init, but upgrading glibc is a different game. – muru May 12 '15 at 17:49
  • Is EST+10 = EFT? – A.B. May 12 '15 at 18:10
4

That would not work:

$ sudo timedatectl set-timezone EST+10
Failed to set time zone: Invalid time zone 'EST+10'

You'd have to use:

$ sudo timedatectl set-timezone EST

In Ubuntu 12.04 you can use this command:

sudo ln -sf /usr/share/zoneinfo/EST /etc/localtime

To get EST from EST+10:

grep -Po "^[A-Z]{3,3}"

EST+10

EST is GMT-5, EST+10 is GMT+5

Therefore you can use:

sudo ln -sf /usr/share/zoneinfo/Etc/GMT+5 /etc/localtime
4
  • I'd assumed EST+10 meant 10 hours ahead of EST (since EST itself is UTC-5, the 10 couldn't be related to what EST is) – muru May 12 '15 at 17:51
  • @muru, yes that is what I found, from an example. – vyom May 13 '15 at 3:35
  • @A.B, so even with timedatectl I cannot use the timezone strings, which are possible with tzset() ? – vyom May 13 '15 at 3:42
  • Timezone is not Offset. See my answer. – A.B. May 13 '15 at 9:58

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.