Difference between revisions of "Linux datetime"

From Noah.org
Jump to navigationJump to search
Line 25: Line 25:
 
== Correct for clock drift ==
 
== Correct for clock drift ==
  
For where its not possible to run ntpd you may use adjtimex to correct for systematic drift.
+
For where its not possible to run [[ntpd]] you may use adjtimex to correct for systematic drift.
  
 
<pre>
 
<pre>
 
aptitude install adjtimex
 
aptitude install adjtimex
 
</pre>
 
</pre>

Revision as of 16:13, 28 July 2008

Set timezone and clock on Linux

1. su to root

2. Find your timezone file under /usr/share/zoneinfo. For example:

   /usr/share/zoneinfo/US/Pacific

3. OPTIONAL: backup the current timezone configuration:

   cp /etc/localtime /etc/localtime.old

4. Create a symbolic link from the appropiate timezone to /etc/localtime.

   ln -sf /usr/share/zoneinfo/US/Pacific /etc/localtime

or

   ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

5. Use rdate or ntpdate to set the system time (ntpdate is better):

   /usr/sbin/ntpdate time.nist.gov

or

   /usr/bin/rdate time.nist.gov

6. Set the hardware clock to the system time:

   /sbin/hwclock --systohc

Correct for clock drift

For where its not possible to run ntpd you may use adjtimex to correct for systematic drift.

aptitude install adjtimex