Latest web development tutorials

Linux clock command

Linux command Daquan Linux command Daquan

Linux clock command is used to adjust the RTC time.

RTC is a built-in computer hardware time, the implementation of this directive can display the current time, adjust the hardware clock time, the system time is set to be consistent with the time clock of the hardware, or the system time is saved back to the hardware clock.

grammar

clock [--adjust][--debug][--directisa][--getepoch][--hctosys][--set --date="<日期时间>"][--setepoch --epoch=< >][--show][--systohc][--test][--utc][--version]

Parameter Description:

  • --adjust first use "--set" or "--systohc" parameter set the hardware clock, will generate a name for adjtime files in the / etc directory. When using these two parameters to adjust the hardware clock again, this file will record the difference between the two adjustments, plus instruction execution clock "--adjust" parameter, the program automatically according to the value of the difference log file, calculate the average future value, automatically adjust the hardware clock.
  • --debug detail display during the execution of instructions, easy to understand the situation or debugging program execution.
  • --directisa instruction not to tell the clock by / dev / rtc device files, direct access to the hardware clock. This parameter only applies to the old PC ISA bus architecture.
  • --getepoch the hardware clock value system within the core of a new era, presenting to the standard output device.
  • --hctosys Hardware Clock to System Time, the system time and hardware clock is set to the same. Since this action will cause the system to access a comprehensive update time of the file, so it is best when the system starts to execute it.
  • --set - date and time date set the hardware clock.
  • --setepoch - a new era of numerical epoch = <year> set of core hardware system clock, year expressed in four words tree.
  • --show read hardware clock time, and presents it to the standard output device.
  • --systohc System Time to Hardware Clock, the system time is stored back in the hardware clock.
  • --test only for testing, not really the time to write hardware clock or system time.
  • --utc the time when the CUT hardware clock, sometimes also referred to as UTC or UCT.
  • --version display version information.

Examples

Get current time

# clock //获取当前的时间

UTC time

# clock -utc //显示UTC时间

Linux command Daquan Linux command Daquan