[Balug-talk] adjusting the clock on a server....

Michael Paoli mp at rawbw.com
Tue Feb 1 00:42:23 PST 2005


Quoting Kathryn Tate <kathryntate at comcast.net>:

> Does anyone know how to adjust the clock on a server
> that is running RedHat9?

There's the system time - the operating system's idea of what time it is.
There's also the hardware clock.

For a LINUX system that always, or almost always runs LINUX (and possibly
other UNIX-like operating systems), it's generally best for the hardware
clock to use UTC.  If it's a system which occasionally or more frequently
runs other operating systems (e.g. Microsoft operating systems) it's
generally more appropriate to have the hardware clock use local time (and
if it's a system, such as a laptop, that periodically or frequently moves
among distinct time zones, things can get even more interesting).

For a system that spends most of its time connected to or having access
to the Internet (or other NTP servers), it's generally best to configure
and use NTP to keep the system clock in sync (and the hardware clock can
then occasionally be set based upon the system time).  Even if the system
only has Internet (or other NTP server) access
intermittently, but on a fairly frequent basis, it still may be preferable
to sync the system clock via NTP (at least when suitable NTP servers are
reachable).

A few other things to keep in mind.  It's generally preferable to adjust
(skew) the system time to the correct time, rather than "jump" the clock -
this especially applies when the system is in multi-user mode, and jumping
the clock backwards can frequently be problematic for many applications.

With a slight bit of Googling, I found this document:
http://www.faqs.org/docs/Linux-HOWTO/TimePrecision-HOWTO.html
which, although not a highly polished piece, gives a fair overview.

If you have NTP server(s) available, and your system time isn't too
far off, you should be able to get synced up with NTP.  If your system time
is farther off, but not too extremely far off, you could use tickadj
or adjtimex to skew the clock, somewhat aggressively (e.g. make it run up to
about 10% faster or slower) until it's to or quite close to the correct
time.  If the system time is way off (weeks, years, ...) you likely have to
resort to "jumping" the system clock to the correct time, with date, or
ntpdate - if you need to do that, it's generally safer to do so in
single user mode (or as part of the boot sequence).

With UNIX-like systems (e.g. LINUX), one wants to pay reasonable attention
to time zones and such - this is particularly important when setting the
time or configuration, as substantial system-wide errors might otherwise be
introduced.  It also bears keeping in mind when interpreting date/time data
(e.g. some things may log or report using UTC, some may use the system's
configured default time zone, and some may use time zone based on
environment of user (/process) invoking the command).

You can probably find lots more about some or all of these topics by
searching (possibly in combination) on one or more of these terms (and/or
consulting their man pages where applicable):
tickadj
adjtimex
NTP
ntpd
xntpd
ntp.conf
ntpdate
hwclock
date
"Red Hat"
LINUX

There are likely also Red Hat Linux 9 specific details (e.g. specific
tools, conventions) that might be found here:
http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/
and/or other similar locations.



More information about the Balug-talk-balug.org mailing list