adjtimex - Linux
Overview
adjtimex is a Linux command used to adjust the system’s clock, providing fine-grained control over various time parameters. It enables precise clock synchronization and correction, especially in critical applications where time accuracy is crucial.
Syntax
adjtimex [-f [file]] [-s [-i]] [-S [-i]] [-t [-i] [freq]] [-o [-i] [ofs]] [-m [-i] [max]] [-c] [-n] [-d] [-D] [-R] [-C] [modes]
Options/Flags
- -f [file]: Read modes from the specified file. Default:
/etc/adjtime
- -s [-i]: Set the leap second mode (0: off, 1: auto, 2: manual). Default: 1
- -S [-i]: Set the synchronization mode (0: false, 1: true). Default: 0
- -t [-i] [freq]: Set the frequency adjustment (in parts per million). Default: 0
- -o [-i] [ofs]: Set the time offset (in microseconds). Default: 0
- -m [-i] [max]: Set the maximum allowed adjustment (in microseconds). Default: 500000
- -c: Calibrate the clock.
- -n: Disable frequency adjustment.
- -d: Disable time offset adjustment.
- -D: Disable maximum adjustment check.
- -R: Reset all parameters to default values.
- -C: Clear the calibration data.
- modes: Specify a combination of the following modes:
- i: Interrogate mode (display current settings)
- e: Enhanced mode (extended precision)
- p: Phase-locked loop mode
- a: Automatic frequency adjustment mode
Examples
Display Current Time Settings:
adjtimex -i
Adjust Frequency manually by +10 PPM:
adjtimex -t 10
Disable Frequency Adjustment:
adjtimex -n
Calibrate Clock:
adjtimex -c
Common Issues
- Clock Drift: If the clock is drifting significantly, check for hardware issues or consult a system administrator.
- Time Offset Too Large: If the time offset is too large, consider investigating network synchronization issues or adjusting the
max
parameter. - Permission Denied: Ensure that you have root privileges or are authorized to execute adjtimex.
Integration
Network Time Synchronization: adjtimex can be used in conjunction with ntpd or other network time synchronization tools to maintain accurate system time.
Precise Clock Control: adjtimex allows for precise clock tuning in applications such as audio/video processing, scientific research, and financial trading.
Related Commands
- ntpdate: Set the system time using a remote time server.
- timedatectl: Display and configure system time and date settings.
- crontab: Schedule tasks at specific times.