Hi when i change the date:

date -s "01 Jan 2011 01:30:15"

Do services such as mysqld and httpd need to be restarted for thier date to update? or is there a better way to handle these services date capabilities. Some sort of reload or update date?


Software like HTTPd, Syslog, and MySQL simply ask the system what time it is with syscalls like gettimeofday(). They don't keep track of time by themselves; that would be horribly inefficient. When you change the system time, applications are automatically "updated".


You should consider setting up ntp on your servers to manage time. ntp polls external time sources and keeps your machine synced up. It also slowly slews the clock over time to keep it in sync, instead of making large time changes all at once. This produces less surprises and helps keep applications from getting confused.

Typically you set up one machine in your organization to run ntp and that machine communicates with an external ntp server. Then, your other servers contact your designated ntp master for their updates. You can use this ntp server tool to find an appropriate external server for you to use. Generally you want to connect to external servers which are geographically close to you.

  • but woudnt ntp come up with the same problem. The servers sets the time but httpd and mysqld are not updated? – Sparky Jan 12 '11 at 5:23
  • Applications just call the system to find out the date and time. Thus if the system time changes, the next call gets an updated answer. You run in to problems when the system changes the time by a large amount suddenly, then applications get confused. Time moving backwards is expecially bad. ntp helps with all of this by gently changing the time in very small increments. – Phil Hollenback Jan 12 '11 at 5:29

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.