⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hwclock.8

📁 Util-linux 软件包包含许多工具。其中比较重要的是加载、卸载、格式化、分区和管理硬盘驱动器
💻 8
📖 第 1 页 / 共 2 页
字号:
.TH HWCLOCK 8 "02 March 1998".SH NAMEhwclock \- query and set the hardware clock (RTC).SH SYNOPSIS.BR "hwclock \-r" " or " "hwclock \-\-show".br.BR "hwclock \-w" " or " "hwclock \-\-systohc".br.BR "hwclock \-s" " or " "hwclock \-\-hctosys" .br.BR "hwclock \-a" " or " "hwclock \-\-adjust".br.BR "hwclock \-v" " or " "hwclock \-\-version".br.B "hwclock \-\-set \-\-date=newdate".br.B "hwclock \-\-getepoch".br.B "hwclock \-\-setepoch \-\-epoch=year".PPother options:.PP.B "[\-u|\-\-utc]  \-\-localtime  \-\-noadjfile \-\-directisa".B "\-\-test [\-D|\-\-debug]".PPand arcane options for DEC Alpha:.PP.B "[\-A|\-\-arc] [\-J|\-\-jensen] [\-S|\-\-srm] [\-F|\-\-funky-toy]".PPMinimum unique abbreviations of all options are acceptable..PPAlso, \-h asks for a help message..SH DESCRIPTION.B hwclockis a tool for accessing the Hardware Clock.  You can display thecurrent time, set the Hardware Clock to a specified time, set theHardware Clock to the System Time, and set the System Time from theHardware Clock..PPYou can also run .B hwclock periodically to insert or remove time from the Hardware Clock tocompensate for systematic drift (where the clock consistently gains orloses time at a certain rate if left to run)..SH OPTIONSYou need exactly one of the following options to tell .B hwclock what function to perform:.PP.TP.B \-\-showRead the Hardware Clock and print the time on Standard Output.The time shown is always in local time, even if you keep your Hardware Clockin Coordinated Universal Time.  See the.B \-\-utcoption..TP.B \-\-setSet the Hardware Clock to the time given by the .B \-\-dateoption..TP.B \-\-hctosysSet the System Time from the Hardware Clock.  Also set the kernel's timezone value to the local timezoneas indicated by the TZ environment variable and/or.IR /usr/share/zoneinfo ,as .BR tzset (3)would interpret them.The obsolete tz_dsttime field of the kernel's timezone value is setto DST_NONE. (For details on what this field used to mean, see.BR settimeofday (2).)This is a good option to use in one of the system startup scripts..TP.B \-\-systohcSet the Hardware Clock to the current System Time..TP.B \-\-adjustAdd or subtract time from the Hardware Clock to account for systematicdrift since the last time the clock was set or adjusted.  See discussionbelow..TP.B \-\-getepochPrint out standard output the kernel's Hardware Clock epoch value.This is the number of years into AD to which a zero year value in theHardware Clock refers.  For example, if you are using the conventionthat the year counter in your Hardware Clock contains the number offull years since 1952, then the kernel's Hardware Counter epoch valuemust be 1952.This epoch value is used whenever hwclock reads or sets the Hardware Clock..TP.B \-\-setepochSet the kernel's Hardware Clock epoch value to the value specified by the.B \-\-epochoption.  See the.B \-\-getepochoption for details..TP.B \-\-versionPrint the version of .B hwclock on Standard Output..TP.B \-\-date=date_stringYou need this option if you specify the.B \-\-setoption.  Otherwise, it is ignored.This specifies the time to which to set the Hardware Clock.The value of this option is an argument to the.BR date (1)program.For example,.sp.I hwclock --set --date="9/22/96 16:45:05".spThe argument is in local time, even if you keep your Hardware Clock in Coordinated Universal time.  See the .B \-\-utcoption..TP.B \-\-epoch=yearSpecifies the year which is the beginning of the Hardware Clock'sepoch.  I.e. the number of years into AD to which a zero value in theHardware Clock's year counter refers. It is used together withthe \-\-setepoch option to set the kernel's idea of the epoch of theHardware Clock, or otherwise to specify the epoch for use withdirect ISA access.For example, on a Digital Unix machine:.sp.I hwclock --setepoch --epoch=1952.PPThe following options apply to most functions..TP.B \-\-utc.TP.B \-\-localtimeIndicates that the Hardware Clock is kept in Coordinated UniversalTime or local time, respectively.  It is your choice whether to keepyour clock in UTC or local time, but nothing in the clock tells whichyou've chosen.  So this option is how you give that information to.BR hwclock .If you specify the wrong one of these options (or specify neither andtake a wrong default), both setting and querying of the Hardware Clockwill be messed up.If you specify neither.B \-\-utcnor.B \-\-localtime, the default is whichever was specified the last time.B hwclockwas used to set the clock (i.e. hwclock was successfully run with the.B \-\-set, .B \-\-systohc,or.B \-\-adjustoptions), as recorded in the adjtime file.  If the adjtime file doesn'texist, the default is local time..TP.B \-\-noadjfiledisables the facilities provided by.IR /etc/adjtime ..B hwclockwill not read nor write to that file with this option. Either.B \-\-utcor.B \-\-localtimemust be specified when using this option..TP.B \-\-directisais meaningful only on an ISA machine or an Alpha (which implements enoughof ISA to be, roughly speaking, an ISA machine for .BR hwclock 'spurposes).  For other machines, it has no effect.  This option tells.B hwclockto use explicit I/O instructions to access the Hardware Clock.Without this option, .B hwclockwill try to use the /dev/rtc device (which it assumes to be driven by thertc device driver).  If it is unable to open the device (for read), it willuse the explicit I/O instructions anyway.The rtc device driver was new in Linux Release 2..TP.B \-\-badyearIndicates that the Hardware Clock is incapable of storing years outsidethe range 1994-1999.  There is a problem in some BIOSes (almost all Award BIOSes made between 4/26/94 and 5/31/95) wherein they are unableto deal with years after 1999.  If one attempts to set the year-of-centuryvalue to something less than 94 (or 95 in some cases), the value thatactually gets set is 94 (or 95).  Thus, if you have one of these machines,.B hwclockcannot set the year after 1999 and cannot use the value of the clock asthe true time in the normal way.To compensate for this (without your getting a BIOS update, which woulddefinitely be preferable), always use .B \-\-badyearif you have one of these machines.  When  .B hwclockknows it's working with a brain-damaged clock, it ignores the year part ofthe Hardware Clock value and instead tries to guess the year based on the last calibrated date in the adjtime file, by assuming that that date iswithin the past year.  For this to work, you had better do a .I hwclock \-\-setor.I hwclock \-\-systohcat least once a year!Though .B hwclockignores the year value when it reads the Hardware Clock, it sets theyear value when it sets the clock.  It sets it to 1995, 1996, 1997, or1998, whichever one has the same position in the leap year cycle asthe true year.  That way, the Hardware Clock inserts leap days wherethey belong.  Again, if you let the Hardware Clock run for more than ayear without setting it, this scheme could be defeated and you couldend up losing a day..B hwclockwarns you that you probably need .B \-\-badyearwhenever it finds your Hardware Clock set to 1994 or 1995.  .TP.B \-\-srmThis option is equivalent to.B \-\-epoch=1900and is used to specify the most common epoch on Alphaswith SRM console..TP.B \-\-arcThis option is equivalent to.B \-\-epoch=1980and is used to specify the most common epoch on Alphaswith ARC console (but Ruffians have epoch 1900)..TP.B \-\-jensen.TP.B \-\-funky\-toyThese two options specify what kind of Alpha machine you have.  Theyare invalid if you don't have an Alpha and are usually unnecessaryif you do, because .B hwclock should be able to determine by itself what it's running on, at least when.I /procis mounted.(If you find you need one of these options to make.B hwclock work, contact the maintainer to see if the program can be improvedto detect your system automatically. Output of `hwclock --debug'and `cat /proc/cpuinfo' may be of interest.).B \-\-jensen means you are running on a Jensen model..B \-\-funky\-toy means that on your machine, one has to use the UF bit insteadof the UIP bit in the Hardware Clock to detect a time transition.  "Toy"in the option name refers to the Time Of Year facility of the machine. .TP.B \-\-testDo everything except actually updating the Hardware Clock or anythingelse.  This is useful, especially in conjunction with.B \-\-debug,in learning about .B hwclock..TP.B \-\-debugDisplay a lot of information about what .B hwclock is doing internally.  Some of its function is complex and this outputcan help you understand how the program works..SH NOTES.SH Clocks in a Linux System.PPThere are two main clocks in a Linux system:.PP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -