Laura Diane Hamilton

Technical Product Manager at Groupon

Resumé

How to Fix Server Time

In the process of troubleshooting a timezone offset issue in my wordpress blog, I discovered to my chagrin that the server time on my Amazon EC2 instance was 6 minutes fast.

I knew a guy in college who would set all his clocks to be 15 minutes fast in order to help him to arrive at appointments on time, but to my understanding the same technique doesn't work particularly well for Linux servers.

(The technique didn't work very well for this gentleman either, to be honest.)

Fortunately, updating the server time is pretty straightforward. sudo apt-get install ntp sudo service ntp stop sudo ntpdate pool.ntp.org sudo service ntp start

Best practice is to keep your server running UTC time, and then if you need to display or use other timezones to make the appropriate adjustments in your web application.

Lauradhamilton.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com.