Man pages sections > man8 > clock

clock - manipulate the CMOS clock

CLOCK(8) System Manager's Manual CLOCK(8)

NAME

clock - manipulate the CMOS clock

SYNOPSIS

clock [-u] [-rwsa] [ -v]

DESCRIPTION

clock manipulates the CMOS clock in variaous ways, allowing it to be read or written, and allowing synchronization between the CMOS clock and the kernel's version of the system time.

OPTIONS

-u
indicates that the CMOS clock is set to universal time
-r
read CMOS clock and print the result to stdout
-w
write the system time into the CMOS clock
-s
set the system time from the CMOS clock
-a
set the system time from the CMOS clock, adjusting the time to correct for systematic error, and writting it back into the CMOS clock.
-v
print version number
The -a option uses the file /etc/adjtime to determine how the clock changes. It contains three numbers:
0(e1.
the correction in seconds per day (for example, if your clock runs 5 seconds fast each day, the first number should read -5.0),
0(e1.
time when clock was last used, in seconds since 1/1/1970,
0(e1.
the remaining part of a second that was left over after the last adjustment.
The following instructions are from the source code:
0(e1.
create a file /etc/adjtime containing as the first and only line: '0.0 0 0.0',
0(e1.
run clock -au or clock -a, depending on whether your CMOS is in Universal or Local Time. This updates the second number,
0(e1.
set your system time using the date command,
0(e1.
update your CMOS time using clock -wu or clock -w,
0(e1.
replace the first number in /etc/adjtime by your correction,
0(e1.
put the command clock -au or clock -a in your /etc/rc.local, or let cron start it regularly.

FILES

/etc/adjtime
/etc/rc.local

AUTHORS

V1.0
Charles Hedrick, hedrick@cs.rutgers.edu, Apr 1992
V1.1
Modified for clock adjustments, Rob Hooft, hooft@chem.ruu.nl, Nov 1992
V1.2
Patches by Harald Koenig, koenig@nova.tat.physik.uni-tuebingen.de, applied by Rob Hooft, hooft@EMBL-Heidelberg.DE, Oct 1993
V1.3
Changes from alan@spri.levels.unisa.edu.au (Alan Modra)
V1.4
Fix for years > 2000 alan@SPRI.Levels.UniSA.Edu.Au (Alan Modra), and added -v option to print version faith@cs.unc.edu, Feb 1995.
V1.4a
Converted to be compatible with the SPARC /dev/rtc driver Tom Dyas (tdyas@eden.rutgers.edu), Aug 1996
V1.4b
Adapted for Power Macintosh by Paul Mackerras, Dec 1996
Debian Sid