0

My servers are Ubuntu 14.04 on AWS. Our application actually needs time in CDT. By default it was UTC, so I created a sysm link for localtime.

ll /etc/localtime lrwxrwxrwx 1 root root 27 Sep 14 03:53 /etc/localtime -> /usr/share/zoneinfo/CST6CDT

And my date command in linux seems ok as it displays time in CDT. Everything works perfect in first glance, however checking in detail shows my server time is actually about 1.5 minutes lagging from original CDT time. Any idea how to correct this?

The problem is our backend is Mysql on RDS, where we set the timezone to US/Central which is in exact sync with original CDT. So my frontend and backend are having a difference of 1.5 mins. This seems to be weird.
But we need the ubuntu instance to be exactly the CDT time.

Thanks in advance

user2700022
  • 121
  • 1
  • 4
  • Just install NTP. You'll find plenty of instructions for this on the web. – Sven Sep 14 '16 at 09:33
  • @Sven Thanks but, this symlink should have been working fine right? The lag, is what I don't understand. I haven't used ntp yet. So apologies if my question is too stupid. Just installing ntp, it will automatically sync this timezone? – user2700022 Sep 14 '16 at 15:47
  • The internal time of a computer is not very precise and can vary a lot, so this discrepancy is to be expected. NTP (network time protocol) is a method to get the correct time from the network to overcome this problem. You might have to configure NTP a bit but this is not very difficult - often it's enough to change one line of the default config file of ntpd. As I said, plenty of guides on the web. – Sven Sep 14 '16 at 15:58
  • @Sven Thank you, just installed NTP, but did not make any changes, the lag did not change instantly, but after couple of minutes, the server time is in perfect sync with CDT. – user2700022 Sep 14 '16 at 16:44
  • That's how NTP works. It establishes stable external time references by comparing multiple sources, skews the server time to match it (rather than making abrupt changes), and continually corrects for the system clock's tendency to drift. It's pretty much the first thing you want to install on a new machine. – Michael - sqlbot Sep 14 '16 at 20:46

0 Answers0