Take the 2-minute tour ×

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?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

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".

share|improve this answer
Thanks hits the dot –  Sparky Jan 12 '11 at 5:29
add comment

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.

share|improve this answer
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
add comment

Your Answer


