MAN page from RedHat 6.X adjtimex-1.3-6.i386.rpm


Section: Maintenance Commands (8)
Updated: February 25, 1997


adjtimex - display or set the kernel time variables 




This program gives you raw access to the kernel time variables. For amachine connected to the Internet, or equipped with a precisionoscillator or radio clock, the best way to regulate the system clockis with xntpd(8). For a standalone or intermittently connectedmachine, you may use adjtimex instead to at least correct forsystematic drift.

Anyone may print out the time variables, but only the superusermay change them.

If your computer can be connected to the net, you might runxntpd for at least several hours and use adjtimex --printto learn what values of tick and freq it settled on. Alternately, youcould estimate values using the CMOS clock as a reference (see the--compare and --adjust switches). You could then add aline to rc.local invoking adjtimex to set those parameterseach time you reboot. 


Options may be introduced by either - or --, and uniqueabbreviations may be used.
Print the current values of the kernel time variables. NOTE: The timeis "raw", and may be off by up to one timer tick (10 msec). "status"gives the value of the time_status variable in the kernel. ForLinux 1.0 and 1.2 kernels, the value is as follows:
      0   clock is synchronized (so the kernel should           periodically set the CMOS clock to match the          system clock)      1   inserting a leap second at midnight      2   deleting a leap second at midnight      3   leap second in progress      4   leap second has occurred      5   clock not externally synchronized (so the           kernel should leave the CMOS clock alone)
For Linux 2.0 kernels, the value is a sum of these:
      1   PLL updates enabled      2   PPS freq discipline enabled      4   PPS time discipline enabled      8   frequency-lock mode enabled     16   inserting leap second     32   deleting leap second     64   clock unsynchronized    128   holding frequency    256   PPS signal present    512   PPS signal jitter exceeded   1024   PPS signal wander exceeded   2048   PPS signal calibration error   4096   clock hardware fault
--tick val
Set the number of microseconds that should be added to the system timefor each kernel tick interrupt. There are supposed to be 100 ticksper second, so val should be close to 10000. Increasingval by 1 speeds up the system clock by about 100 ppm, or 8.64sec/day. tick must be in the range 9000...11000.
--frequency newfreq
Set the system clock frequency offset to newfreq. newfreqcan be negative or positive, and gives a much finer adjustment thanthe --tick switch. The value is scaled such that newfreq= 1<<16 speeds up the system clock by about 1 ppm, or .0864 sec/day.Thus, --tick 10000 --frequency 6553600 is about the same as--tick 10001 --frequency 0. newfreq must be in the range-6553600...6553600, allowing maximum adjustments of plus or minus 100ppm.
Periodically compare the system clock with the CMOS clock. After thefirst two calls, print values for tick and frequency offset that wouldbring the system clock into approximate agreement with the CMOS clock.CMOS clock readings are adjusted for systematic drift using using thecorrection in /etc/adjtime --- see clock(8). Theinterval between comparisons is 10 seconds, unless changed by the--interval switch. The optional argument is the number ofcomparisons. (If the argument is supplied, the "=" isrequired.)
Same as --compare, except the recommended values are actually installed after every other comparison.
--interval tim
Set the interval in seconds between clock comparisons for the--compare and --adjust options.
--singleshot adj
Slew the system clock by adj usec. (Its rate is changed temporarily by about 1 part in 2000.)
--offset adj
Add a time offset of adj usec.The kernel code adjusts the time gradually by adj, notes how long it has been since the last time offset, and then adjusts the frequency offset to correct for the apparent drift. adj must be in the range -512000...512000.
--maxerror val
Set maximum error (usec).
--esterror val
Set estimated error (usec). The maximum and estimated error are not used by the kernel.They are merely made available to user processes via the adjtimex(2) system call.
--timeconstant val
Set phase locked loop (PLL) time constant. val determines the bandwidth or "stiffness"of the PLL. The effective PLL time constant will be a multiple of (1<< val). For room-temperature quartzoscillators, David Mills recommends the value 2,which correspondsto a PLL time constant of about 900 sec and a maximum update intervalof about 64 sec. The maximum update interval scales directly with thetime constant, so that at the maximum time constant of 6, theupdate interval can be as large as 1024 sec.

Values of val between zero and 2 give quick convergence; valuesbetween 2 and 6 can be used to reduce network load, but at a modest costin accuracy.

Print the program options.
Print the program version.



If your system clock gained 8 seconds in 24 hours, youcould set the tick to 9999, and then it would lose 0.64 seconds a day(that is, 1 tick unit = 8.64 seconds per day).To correct the rest of the error, you could set the frequency offset to(1<<16)*0.64/.0864 = 485452. Thus, putting the followingin rc.local would approximately correct the system clock:

     adjtimex  --tick 9999  --freq 485452



adjtimex deals only with the system clock --- the one that runswhile the computer is powered up. To set or regulate the CMOS clock,see clock(8). 


Steven S. Dick <>, Jim Van Zandt <>. 


date(1L), gettimeofday(2), settimeofday(2), clock(8), xntpd(8),/usr/src/linux/include/linux/timex.h,/usr/src/linux/include/linux/sched.h,/usr/src/linux/kernel/time.c,/usr/src/linux/kernel/sched.c




This document was created byman2html,using the manual pages.