set_clock - set the system and hardware clock


This is a program to set the system and hardware clock with time obtained from an external network source (default is the time server at NIST). The user may optionally specify how the time is stored on the hardware clock; either in local time (the default) or in universal (formerly GMT) time.


        set_clock [-h | --help] [-u]


        -h, --help      Display this help message and exit.
        -u              Use universal time
        NOTE: You must be the superuser to run this script.



Sets the system and hardware clocks to the current time obtained from the time server. The hardware clock is set to local time. Systems that continue to support legacy operating systems (dual-booting) generally set the hardware clock to local time for compatibility.

        set_clock -u

As above except the hardware clock is set to universal time. This is how most Unix-friendly systems do it.


Copy this script into a directory where system adminsitration tools go. How about /usr/local/sbin?

Tested With:

This script works with Red Hat v5.x-7.x. It uses rdate and hwclock.


Copyright 2000-2002, William Shotts <>

This software is part of the project, a site for Linux education and advocacy devoted to helping users of legacy operating systems migrate into the future.

You may contact the project at:


This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

$Id: set_clock.README,v 1.2 2002/02/18 14:18:38 bshotts Exp $