Accueil

CPU_SET
INFINITY
MB_CUR_MAX
MB_LEN_MAX
__setfpucw
_exit
_syscall
a64l
abort
abs
accept
access
acct
acos
acosh
addpart
addseverity
adduser
adjtime
adjtimex
aio_cancel
aio_error
aio_fsync
aio_read
aio_return
aio_suspend
aio_write
alarm
alloc_hugepages
alloca
apropos
arch
arch_prctl
argz_add
armscii-8
arp
ascii
asin
asinh
asprintf
assert
assert_perror
at
atan
atan2
atanh
atd
atexit
atof
atoi
atq
atrm
atrun
backend-spec
backtrace
basename
bash
bashbug
batch
bcmp
bcopy
bdflush
bind
bindresvport
blockdev
boot
bootlogd
bootparam
bosskill
brk
bsd_signal
bsearch
bstring
btowc
btree
builtin
builtins
byteorder
bzero
c
cabs
cacheflush
cacos
cacosh
cal
canonicalize_file_name
capabilities
capget
carg
casin
casinh
catan
catanh
catgets
catopen
cbrt
ccos
ccosh
ceil
cerf
cexp
cexp2
cfree
chage
charmap
charsets
chatise
chdir
chgrp
chmod
chown
chpasswd
chroot
chrt
chsh
cimag
clearenv
clock
clock_getcpuclockid
clock_getres
clock_nanosleep
clog
clog10
clog2
clone
close
closedir
cmp
cmsg
col
complex
confstr
conj
connect
console
console_codes
console_ioctl
consoletype
copysign
core
cos
cosh
cp
cp1251
cpow
cproj
cpuid
cpuset
creal
create_module
createrepo
credentials
cron
crond
crontab
crypt
crypttab
csin
csinh
csqrt
ctan
ctanh
ctermid
ctime
ctluser
ctrlaltdel
daemon
db2dvi
db2html
db2pdf
db2ps
db2rtf
dbopen
dd
ddp
delete_module
delpart
depmod
des_crypt
df
diff
diff3
difftime
dir
dir_colors
dircolors
dirfd
div
dl_iterate_phdr
dlopen
dmesg
docbook2dvi
docbook2html
docbook2man
docbook2man-spec
docbook2pdf
docbook2ps
docbook2rtf
docbook2tex
docbook2texi
docbook2texi-spec
docbook2txt
doexec
domainname
dprintf
drand48
drand48_r
dsp56k
du
dup
dysize
ecvt
ecvt_r
egrep
eject
elf
encrypt
end
endian
environ
envz_add
epoll
epoll_create
epoll_ctl
epoll_wait
erf
erfc
err
errno
error
ether_aton
ethers
euidaccess
eventfd
evim
exec
execve
exit
exit_group
exp
exp10
exp2
expm1
exportfs
exports
fabs
faccessat
faillog
fallocate
fchmodat
fchownat
fclose
fcloseall
fcntl
fd
fdformat
fdim
fdisk
feature_test_macros
fenv
ferror
fexecve
fflush
ffs
fgetgrent
fgetpwent
fgetwc
fgetws
fgrep
fifo
filesystems
finite
flock
flockfile
floor
fma
fmax
fmemopen
fmin
fmod
fmtmsg
fnmatch
fopen
fopencookie
fork
fpathconf
fpclassify
fpurge
fputwc
fputws
fread
free
frexp
frontend-spec
fseek
fseeko
fstab
fstab-decode
fstatat
fsync
ftime
ftok
ftpusers
fts
ftw
full
fuser
futex
futimes
futimesat
fwide
gamma
gcvt
get_kernel_syms
get_mempolicy
get_thread_area
getaddrinfo
getcontext
getcpu
getcwd
getdate
getdents
getdirentries
getdomainname
getdtablesize
getenv
getfsent
getgid
getgrent
getgrent_r
getgrnam
getgrouplist
getgroups
gethostbyname
gethostid
gethostname
getifaddrs
getipnodebyname
getitimer
getkey
getline
getloadavg
getlogin
getmntent
getnameinfo
getnetent
getnetent_r
getopt
getpagesize
getpass
getpeername
getpid
getpriority
getprotoent
getprotoent_r
getpt
getpw
getpwent
getpwent_r
getpwnam
getresuid
getrlimit
getrpcent
getrpcent_r
getrpcport
getrusage
gets
getservent
getservent_r
getsid
getsockname
getsockopt
getsubopt
gettid
gettimeofday
getttyent
getuid
getumask
getusershell
getutent
getutmp
getw
getwchar
getxattr
glob
gnu_get_libc_version
gpasswd
grantpt
grep
group
groupadd
groupdel
groupmod
grpck
grpconv
grpunconv
gshadow
gsignal
gssd
gunzip
guru
gzexe
gzip
halt
hash
hd
hier
host
hostname
hosts
hsearch
hypot
i386
icmp
iconv
iconv_close
iconv_open
idle
idmapd
ifconfig
ilogb
index
inet
inet_ntop
inet_pton
infnan
init
init_module
initgroups
initlog
initrd
initscript
inittab
inotify
inotify_add_watch
inotify_init
inotify_rm_watch
insmod
insque
install
install-catalog
intro
io_cancel
io_destroy
io_getevents
io_setup
io_submit
ioctl
ioctl_list
ioperm
iopl
ioprio_set
ip
ipc
ipcalc
ipcrm
ipcs
ipv6
isalpha
isatty
isgreater
iso_8859-1
iso_8859-10
iso_8859-11
iso_8859-13
iso_8859-14
iso_8859-15
iso_8859-16
iso_8859-2
iso_8859-3
iso_8859-4
iso_8859-5
iso_8859-6
iso_8859-7
iso_8859-8
iso_8859-9
issue
iswalnum
iswalpha
iswblank
iswcntrl
iswctype
iswdigit
iswgraph
iswlower
iswprint
iswpunct
iswspace
iswupper
iswxdigit
j0
jade
jw
key_setsecret
kill
killall
killall5
killpg
koi8-r
koi8-u
last
lastb
lastlog
ld
ldconfig
ldd
ldexp
lgamma
libc
link
linkat
linux32
linux64
listen
listxattr
llseek
ln
locale
localeconv
lockd
lockf
log
log10
log1p
log2
logb
login
longjmp
lookup_dcookie
lp
lrint
lround
ls
lsearch
lseek
lseek64
lsmod
lspci
lsusb
madvise
mailaddr
makecontext
makedev
makewhatis
malloc
malloc_hook
man
man-pages
math_error
matherr
mbind
mblen
mbrlen
mbrtowc
mbsinit
mbsnrtowcs
mbsrtowcs
mbstowcs
mbtowc
mcookie
mdoc
mem
memccpy
memchr
memcmp
memcpy
memfrob
memmem
memmove
mempcpy
memset
mesg
mincore
mkdir
mkdirat
mkdtemp
mkfifo
mkfifoat
mkfs
mknod
mknodat
mkstemp
mkswap
mktemp
mlock
mmap
mmap2
modf
modify_ldt
modifyrepo
modinfo
modprobe
more
motd
mount
mountd
mountpoint
mouse
move_pages
mpool
mprotect
mq_close
mq_getattr
mq_getsetattr
mq_notify
mq_open
mq_overview
mq_receive
mq_send
mq_unlink
mremap
msgctl
msgget
msgop
msr
msync
mtrace
mv
nan
nanosleep
netdevice
netlink
netreport
netstat
networks
newgrp
newusers
nextafter
nfs
nfsd
nfsservctl
nfsstat
nice
nicknames
nisdomainname
nl_langinfo
nmap
nologin
nscd
nsgmls
nsswitch
ntpd
ntpdc
null
numa
offsetof
on_exit
onsgmls
open
openat
opendir
openjade
openpty
operator
osgmlnorm
ospam
ospcat
ospent
osx
outb
package-cleanup
packet
passwd
path_resolution
pause
pciconfig_read
pcilib
perror
personality
pgrep
pidof
pipe
pivot_root
pkill
plipconfig
pmap
poll
popen
posix_fadvise
posix_fallocate
posix_memalign
posix_openpt
posixoptions
pow
pow10
poweroff
ppp-watch
pppoe
pppoe-connect
pppoe-relay
pppoe-server
pppoe-setup
pppoe-sniff
pppoe-start
pppoe-status
pppoe-stop
pppoe-wrapper
prctl
pread
printf
proc
profil
program_invocation_name
protocols
psignal
pstree
pthread_atfork
pthread_attr_destroy
pthread_attr_getdetachstate
pthread_attr_getinheritsched
pthread_attr_getschedparam
pthread_attr_getschedpolicy
pthread_attr_getscope
pthread_attr_init
pthread_attr_setaffinity_np
pthread_attr_setdetachstate
pthread_attr_setguardsize
pthread_attr_setinheritsched
pthread_attr_setschedparam
pthread_attr_setschedpolicy
pthread_attr_setscope
pthread_attr_setstack
pthread_attr_setstackaddr
pthread_attr_setstacksize
pthread_cancel
pthread_cleanup_pop
pthread_cleanup_pop_restore_np
pthread_cleanup_push
pthread_cleanup_push_defer_np
pthread_cond_broadcast
pthread_cond_destroy
pthread_cond_init
pthread_cond_signal
pthread_cond_timedwait
pthread_cond_wait
pthread_condattr_destroy
pthread_condattr_init
pthread_create
pthread_detach
pthread_equal
pthread_exit
pthread_getattr_np
pthread_getcpuclockid
pthread_getschedparam
pthread_getspecific
pthread_join
pthread_key_create
pthread_key_delete
pthread_kill
pthread_kill_other_threads_np
pthread_mutex_destroy
pthread_mutex_init
pthread_mutex_lock
pthread_mutex_trylock
pthread_mutex_unlock
pthread_mutexattr_destroy
pthread_mutexattr_getkind_np
pthread_mutexattr_gettype
pthread_mutexattr_init
pthread_mutexattr_setkind_np
pthread_mutexattr_settype
pthread_once
pthread_self
pthread_setaffinity_np
pthread_setcancelstate
pthread_setcanceltype
pthread_setconcurrency
pthread_setschedparam
pthread_setschedprio
pthread_setspecific
pthread_sigmask
pthread_testcancel
pthread_tryjoin_np
pthread_yield
pthreads
ptrace
pts
ptsname
pty
putenv
putgrent
putpwent
puts
putwchar
pwck
pwconv
pwdx
pwunconv
qecvt
qsort
query_module
queue
quotactl
raise
ram
rand
random
random_r
raw
rbash
rcmd
re_comp
read
readahead
readdir
readlink
readlinkat
readv
realpath
reboot
recno
recv
regex
remainder
remap_file_pages
remove
removexattr
remquo
rename
renameat
renice
repo-rss
repoquery
reposync
resolv
resolver
rev
rewinddir
rexec
rgrep
rint
rm
rmdir
rmmod
round
route
rpc
rpm
rpmatch
rquotad
rtc
rtime
rtld-audit
rtnetlink
runlevel
scalb
scalbln
scandir
scanf
sched_get_priority_max
sched_getcpu
sched_rr_get_interval
sched_setaffinity
sched_setparam
sched_setscheduler
sched_yield
sd
sdiff
securetty
sed
seekdir
select
select_tut
sem_close
sem_destroy
sem_getvalue
sem_init
sem_open
sem_overview
sem_post
sem_unlink
sem_wait
semctl
semget
semop
send
sendfile
service
services
set_mempolicy
set_thread_area
set_tid_address
setaliasent
setarch
setbuf
setenv
seteuid
setfsgid
setfsuid
setgid
setjmp
setlocale
setlogmask
setnetgrent
setpci
setpgid
setresuid
setreuid
setsid
setuid
setup
setxattr
sfdisk
sg
sgetmask
sgmldiff
sgmlnorm
shadow
shells
shm_open
shm_overview
shmctl
shmget
shmop
showmount
shutdown
sigaction
sigaltstack
siginterrupt
signal
signalfd
signbit
significand
sigpause
sigpending
sigprocmask
sigqueue
sigreturn
sigset
sigsetops
sigsuspend
sigvec
sigwait
sigwaitinfo
sin
sincos
sinh
sk98lin
skill
slabinfo
slabtop
slattach
sleep
snice
sockatmark
socket
socketcall
socketpair
spam
spent
splice
spu_create
spu_run
spufs
sqrt
st
standards
stat
statd
statfs
statvfs
stdarg
stdin
stdio
stdio_ext
stime
stpcpy
stpncpy
strcasecmp
strcat
strchr
strcmp
strcoll
strcpy
strdup
strerror
strfmon
strfry
strftime
string
strlen
strnlen
strpbrk
strptime
strsep
strsignal
strspn
strstr
strtod
strtoimax
strtok
strtol
strtoul
strverscmp
strxfrm
suffixes
sulogin
svcgssd
svipc
swab
swapoff
swapon
switchdesk
sx
symlink
symlinkat
sync
sync_file_range
sys-unconfig
syscall
syscalls
sysconf
sysctl
sysfs
sysinfo
syslog
system
sysv_signal
tailf
tan
tanh
tcgetpgrp
tcgetsid
tcp
tee
telinit
telldir
tempnam
termcap
termio
termios
tgamma
time
timegm
timer_create
timer_delete
timer_getoverrun
timer_settime
timeradd
timerfd_create
times
tkill
tkpppoe
tload
tmpfile
tmpnam
toascii
touch
toupper
towctrans
towlower
towupper
trunc
truncate
tsearch
tty
ttyS
tty_ioctl
ttyname
ttyslot
ttytype
tzfile
tzselect
tzset
ualarm
udp
udplite
ulimit
umask
umount
uname
undocumented
ungetwc
unicode
unimplemented
units
unix
unlink
unlinkat
unlocked_stdio
unlockpt
unshare
update-pciids
updwtmp
uptime
uri
uselib
useradd
userdel
usermod
usernetctl
usleep
ustat
utf-8
utime
utimensat
utmp
vcs
vdir
vfork
vhangup
vigr
vim
vimdiff
vimtutor
vipw
vm86
vmsplice
vmstat
volname
w
wait
wait4
wall
watch
wavelan
wcpcpy
wcpncpy
wcrtomb
wcscasecmp
wcscat
wcschr
wcscmp
wcscpy
wcscspn
wcsdup
wcslen
wcsncasecmp
wcsncat
wcsncmp
wcsncpy
wcsnlen
wcsnrtombs
wcspbrk
wcsrchr
wcsrtombs
wcsspn
wcsstr
wcstoimax
wcstok
wcstombs
wcswidth
wctob
wctomb
wctrans
wctype
wcwidth
whatis
whereis
wmemchr
wmemcmp
wmemcpy
wmemmove
wmemset
wordexp
wprintf
write
x25
x86_64
xcrypt
xdr
xxd
y0
ypcat
ypchfn
ypchsh
ypdomainname
ypmatch
yppasswd
yppoll
ypset
yptest
ypwhich
yum
yum-builddep
yum-complete-transaction
yum-shell
yum-updatesd
yum-utils
yum-verify
yumdownloader
zcat
zcmp
zdiff
zdump
zforce
zgrep
zic
zmore
znew

Pages de MAN

HWCLOCK(8)							    HWCLOCK(8)



NAME
       hwclock - query and set the hardware clock (RTC)

SYNOPSIS
       hwclock [functions] [options]


DESCRIPTION
       hwclock	is  a  tool for accessing the Hardware Clock.  You can display
       the current time, set the Hardware Clock to a specified time,  set  the
       Hardware	 Clock	to  the	 System Time, and set the System Time from the
       Hardware Clock.

       You can also run hwclock periodically to insert or remove time from the
       Hardware Clock to compensate for systematic drift (where the clock con-
       sistently gains or loses time at a certain rate if left to run).


FUNCTIONS
       You need exactly one of the following  options  to  tell	 hwclock  what
       function to perform:


       -r, --show
	      Read  the	 Hardware Clock and print the time on Standard Output.
	      The time shown is always in local time, even if  you  keep  your
	      Hardware	Clock  in  Coordinated	Universal Time.	 See the --utc
	      option.


       --set  Set the Hardware Clock to the time given by the --date option.

       -s, --hctosys
	      Set the System Time from the Hardware Clock.

	      Also set the kernel's timezone value to the  local  timezone  as
	      indicated by the TZ environment variable and/or /usr/share/zone-
	      info, as tzset(3) would interpret them.  The obsolete tz_dsttime
	      field  of	 the  kernel's timezone value is set to DST_NONE. (For
	      details on what this field used to mean, see settimeofday(2).)

	      This is a good option to	use  in	 one  of  the  system  startup
	      scripts.

       -w, --systohc
	      Set the Hardware Clock to the current System Time.

       --systz
	      Reset the System Time based on the current timezone.

	      Also  set	 the  kernel's timezone value to the local timezone as
	      indicated by the TZ environment variable and/or /usr/share/zone-
	      info, as tzset(3) would interpret them.  The obsolete tz_dsttime
	      field of the kernel's timezone value is set  to  DST_NONE.  (For
	      details on what this field used to mean, see settimeofday(2).)

	      This  is an alternate option to --hctosys that does not read the
	      hardware clock, and may be used in system	 startup  scripts  for
	      recent  2.6  kernels where you know the System Time contains the
	      Hardware Clock time.

       --adjust
	      Add or subtract time from the Hardware Clock to account for sys-
	      tematic drift since the last time the clock was set or adjusted.
	      See discussion below.

       --getepoch
	      Print the kernel's Hardware Clock epoch value to	standard  out-
	      put.   This  is the number of years into AD to which a zero year
	      value in the Hardware Clock refers.  For	example,  if  you  are
	      using  the  convention  that  the	 year counter in your Hardware
	      Clock contains the number of full years  since  1952,  then  the
	      kernel's Hardware Counter epoch value must be 1952.

	      This  epoch  value  is  used  whenever hwclock reads or sets the
	      Hardware Clock.

       --setepoch
	      Set the kernel's Hardware Clock epoch value to the value	speci-
	      fied  by	the  --epoch  option.	See  the --getepoch option for
	      details.

       -v, --version
	      Print the version of hwclock on Standard Output.

       --date=date_string
	      You need this option if you specify the  --set  option.	Other-
	      wise,  it	 is  ignored.  This specifies the time to which to set
	      the Hardware Clock.  The value of this option is an argument  to
	      the date(1) program.  For example,

	      hwclock --set --date="9/22/96 16:45:05"

	      The  argument  is	 in local time, even if you keep your Hardware
	      Clock in Coordinated Universal time.  See the --utc option.


       --epoch=year
	      Specifies the year  which	 is  the  beginning  of	 the  Hardware
	      Clock's epoch.  I.e. the number of years into AD to which a zero
	      value in the Hardware Clock's year counter refers.  It  is  used
	      together	with the --setepoch option to set the kernel's idea of
	      the epoch of the Hardware Clock, or  otherwise  to  specify  the
	      epoch for use with direct ISA access.

	      For example, on a Digital Unix machine:

	      hwclock --setepoch --epoch=1952



OPTIONS
       The following options apply to most functions.

       -u, --utc

       --localtime
	      Indicates that the Hardware Clock is kept in Coordinated Univer-
	      sal Time or local time, respectively.  It is your choice whether
	      to  keep	your  clock  in	 UTC or local time, but nothing in the
	      clock tells which you've chosen.	So this option is how you give
	      that information to hwclock.

	      If  you  specify the wrong one of these options (or specify nei-
	      ther and take a wrong default), both setting and querying of the
	      Hardware Clock will be messed up.

	      If  you  specify	neither --utc nor --localtime , the default is
	      whichever was specified the last time hwclock was	 used  to  set
	      the  clock  (i.e.	 hwclock  was successfully run with the --set,
	      --systohc, or --adjust options),	as  recorded  in  the  adjtime
	      file.   If  the adjtime file doesn't exist, the default is local
	      time.


       --noadjfile
	      disables the facilities provided by /etc/adjtime.	 hwclock  will
	      not  read	 nor write to that file with this option. Either --utc
	      or --localtime must be specified when using this option.


       --adjfile=filename
	      overrides the default /etc/adjtime.


       -f, --rtc=filename
	      overrides the default /dev file name, which is /dev/rtc on  many
	      platforms but may be /dev/rtc0, /dev/rtc1, and so on.


       --directisa
	      is  meaningful  only on an ISA machine or an Alpha (which imple-
	      ments enough of ISA to be, roughly speaking, an ISA machine  for
	      hwclock's	 purposes).   For  other  machines,  it has no effect.
	      This option tells hwclock to use explicit	 I/O  instructions  to
	      access  the  Hardware  Clock.  Without this option, hwclock will
	      try to use the /dev/rtc device (which it assumes to be driven by
	      the rtc device driver).  If it is unable to open the device (for
	      read), it will use the explicit I/O instructions anyway.

	      The rtc device driver was new in Linux Release 2.

       --badyear
	      Indicates that the Hardware Clock is incapable of storing	 years
	      outside  the 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 unable to deal with years after 1999.	If one
	      attempts to set the year-of-century value to something less than
	      94 (or 95 in some cases), the value that actually gets set is 94
	      (or 95).	Thus, if you have one of these machines, hwclock  can-
	      not  set	the  year  after  1999 and cannot use the value of the
	      clock as the true time in the normal way.

	      To compensate for this (without  your  getting  a	 BIOS  update,
	      which  would  definitely be preferable), always use --badyear if
	      you have one of these machines.  When hwclock knows it's working
	      with  a  brain-damaged  clock,  it  ignores the year part of the
	      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 is within the past year.  For this to  work,  you
	      had better do a hwclock --set or hwclock --systohc at least once
	      a year!

	      Though hwclock ignores the year value when it reads the Hardware
	      Clock,  it  sets the year value when it sets the clock.  It sets
	      it to 1995, 1996, 1997, or 1998,	whichever  one	has  the  same
	      position in the leap year cycle as the true year.	 That way, the
	      Hardware Clock inserts leap days where they belong.   Again,  if
	      you let the Hardware Clock run for more than a year without set-
	      ting it, this scheme could be defeated and you could end up los-
	      ing a day.

	      hwclock  warns  you that you probably need --badyear whenever it
	      finds your Hardware Clock set to 1994 or 1995.


       --srm  This option is equivalent to --epoch=1900 and is used to specify
	      the most common epoch on Alphas with SRM console.

       --arc  This option is equivalent to --epoch=1980 and is used to specify
	      the most common epoch on Alphas with ARC console	(but  Ruffians
	      have epoch 1900).

       --jensen

       --funky-toy
	      These  two  options specify what kind of Alpha machine you have.
	      They are invalid if you don't have  an  Alpha  and  are  usually
	      unnecessary  if you do, because hwclock should be able to deter-
	      mine by itself what it's running on,  at	least  when  /proc  is
	      mounted.	 (If  you  find	 you need one of these options to make
	      hwclock work, contact the maintainer to see if the  program  can
	      be  improved  to	detect	your  system  automatically. Output of
	      'hwclock --debug' and 'cat /proc/cpuinfo' may be of interest.)

	      --jensen means you are running on a Jensen model.

	      --funky-toy means that on your machine, one has to  use  the  UF
	      bit  instead  of	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.



       --test Do  everything  except  actually	updating the Hardware Clock or
	      anything else.  This is useful, especially in  conjunction  with
	      --debug, in learning about hwclock.

       --debug
	      Display  a lot of information about what hwclock is doing inter-
	      nally.  Some of its function is complex and this output can help
	      you understand how the program works.



NOTES
Clocks in a Linux System
       There are two main clocks in a Linux system:

       The Hardware Clock: This is a clock that runs independently of any con-
       trol program running in the CPU and even when the  machine  is  powered
       off.

       On  an ISA system, this clock is specified as part of the ISA standard.
       The control program can read or set this clock to a whole  second,  but
       the  control  program  can  also detect the edges of the 1 second clock
       ticks, so the clock actually has virtually infinite precision.

       This clock is commonly called the hardware clock, the real time	clock,
       the  RTC,  the  BIOS clock, and the CMOS clock.	Hardware Clock, in its
       capitalized form, was coined for use by	hwclock	 because  all  of  the
       other names are inappropriate to the point of being misleading.

       So  for	example, some non-ISA systems have a few real time clocks with
       only one of them having its own power domain.  A very low power	exter-
       nal  I2C	 or  SPI clock chip might be used with a backup battery as the
       hardware clock to initialize a  more  functional	 integrated  real-time
       clock which is used for most other purposes.

       The System Time: This is the time kept by a clock inside the Linux ker-
       nel and driven by a timer interrupt.  (On an  ISA  machine,  the	 timer
       interrupt  is  part  of	the  ISA standard).  It has meaning only while
       Linux is running on the machine.	 The System Time is the number of sec-
       onds since 00:00:00 January 1, 1970 UTC (or more succinctly, the number
       of seconds since 1969).	The System Time is not an integer, though.  It
       has virtually infinite precision.

       The  System  Time is the time that matters.  The Hardware Clock's basic
       purpose in a Linux system is to keep time when Linux  is	 not  running.
       You initialize the System Time to the time from the Hardware Clock when
       Linux starts up, and then never use the	Hardware  Clock	 again.	  Note
       that in DOS, for which ISA was designed, the Hardware Clock is the only
       real time clock.

       It is important that the System Time not have any discontinuities  such
       as  would  happen  if you used the date(1L) program to set it while the
       system is running.  You can, however, do whatever you want to the Hard-
       ware  Clock while the system is running, and the next time Linux starts
       up, it will do so with the adjusted time from the Hardware Clock.   You
       can also use the program adjtimex(8) to smoothly adjust the System Time
       while the system runs.

       A Linux kernel maintains a concept of a local timezone for the  system.
       But  don't  be  misled  -- almost nobody cares what timezone the kernel
       thinks it is in.	 Instead, programs that care about the timezone	 (per-
       haps  because  they want to display a local time for you) almost always
       use a more traditional method of determining the timezone: They use the
       TZ  environment	variable  and/or the /usr/share/zoneinfo directory, as
       explained in the man page for tzset(3).	 However,  some	 programs  and
       fringe  parts  of  the  Linux kernel such as filesystems use the kernel
       timezone value.	An example is the  vfat	 filesystem.   If  the	kernel
       timezone	 value	is  wrong, the vfat filesystem will report and set the
       wrong timestamps on files.

       hwclock sets the kernel timezone to the value indicated	by  TZ	and/or
       /usr/share/zoneinfo  when  you  set the System Time using the --hctosys
       option.

       The timezone value actually consists of two parts: 1) a	field  tz_min-
       uteswest	 indicating how many minutes local time (not adjusted for DST)
       lags behind UTC, and 2) a field tz_dsttime indicating the type of  Day-
       light  Savings  Time (DST) convention that is in effect in the locality
       at the present time.  This second field is not used under Linux and  is
       always zero.  (See also settimeofday(2).)


How hwclock Accesses the Hardware Clock
       hwclock	uses many different ways to get and set Hardware Clock values.
       The most normal way is to do I/O to the device special  file  /dev/rtc,
       which is presumed to be driven by the rtc device driver.	 However, this
       method is not always available.	For one thing, the  rtc	 driver	 is  a
       relatively  recent  addition  to	 Linux.	  Older systems don't have it.
       Also, though there are versions of the rtc  driver  that	 work  on  DEC
       Alphas,	there  appear  to  be plenty of Alphas on which the rtc driver
       does not work (a common symptom is hwclock hanging).  Moreover,	recent
       Linux  systems  have  more  generic support for RTCs, even systems that
       have more than one, so you might need to override the default by speci-
       fying /dev/rtc0 or /dev/rtc1 instead.

       On older systems, the method of accessing the Hardware Clock depends on
       the system hardware.

       On an ISA system, hwclock can directly access the "CMOS memory"	regis-
       ters  that  constitute  the clock, by doing I/O to Ports 0x70 and 0x71.
       It does this with actual I/O instructions and consequently can only  do
       it  if  running	with  superuser	 effective  userid.  (In the case of a
       Jensen Alpha, there is no way for hwclock to execute those I/O instruc-
       tions,  and so it uses instead the /dev/port device special file, which
       provides almost as low-level an interface to the I/O subsystem).

       This is a really poor method of accessing the clock, for all  the  rea-
       sons  that  user space programs are generally not supposed to do direct
       I/O and disable interrupts.  Hwclock provides it because it is the only
       method  available on ISA and Alpha systems which don't have working rtc
       device drivers available.


       On an m68k system, hwclock can access the clock via the console driver,
       via the device special file /dev/tty1.

       hwclock	tries  to  use	/dev/rtc.  If it is compiled for a kernel that
       doesn't have that function or it is unable to  open  /dev/rtc  (or  the
       alternative  special  file  you've defined on the command line) hwclock
       will fall back to another method, if available.	On  an	ISA  or	 Alpha
       machine,	 you  can  force hwclock to use the direct manipulation of the
       CMOS registers without even trying /dev/rtc by specifying the  --direc-
       tisa option.



The Adjust Function
       The  Hardware Clock is usually not very accurate.  However, much of its
       inaccuracy is completely predictable -  it  gains  or  loses  the  same
       amount  of time every day.  This is called systematic drift.  hwclock's
       "adjust" function lets you make systematic corrections to  correct  the
       systematic drift.

       It works like this: hwclock keeps a file, /etc/adjtime, that keeps some
       historical information.	This is called the adjtime file.

       Suppose you start with no adjtime file.	You issue a hwclock --set com-
       mand  to set the Hardware Clock to the true current time.  Hwclock cre-
       ates the adjtime file and records in it the current time	 as  the  last
       time  the  clock was calibrated.	 5 days later, the clock has gained 10
       seconds, so you issue another hwclock --set command to set it  back  10
       seconds.	  Hwclock updates the adjtime file to show the current time as
       the last time the clock was calibrated, and records 2 seconds  per  day
       as  the	systematic  drift  rate.  24 hours go by, and then you issue a
       hwclock --adjust command.  Hwclock consults the adjtime file  and  sees
       that  the clock gains 2 seconds per day when left alone and that it has
       been left alone for exactly one day.  So it subtracts  2	 seconds  from
       the  Hardware Clock.  It then records the current time as the last time
       the clock was adjusted.	Another 24 hours goes by and you issue another
       hwclock --adjust.  Hwclock does the same thing: subtracts 2 seconds and
       updates the adjtime file with the current time as  the  last  time  the
       clock was adjusted.

       Every  time  you	 calibrate (set) the clock (using --set or --systohc),
       hwclock recalculates the systematic drift rate based on how long it has
       been  since  the	 last calibration, how long it has been since the last
       adjustment, what drift rate was assumed in any intervening adjustments,
       and the amount by which the clock is presently off.

       A  small	 amount of error creeps in any time hwclock sets the clock, so
       it refrains from making an adjustment that would be less than 1 second.
       Later  on,  when you request an adjustment again, the accumulated drift
       will be more than a second and hwclock will do the adjustment then.

       It is good to do a hwclock --adjust just before the  hwclock  --hctosys
       at system startup time, and maybe periodically while the system is run-
       ning via cron.

       The adjtime file, while named for its historical purpose of controlling
       adjustments  only,  actually  contains  other  information  for	use by
       hwclock in remembering information from one invocation to the next.

       The format of the adjtime file is, in ASCII:

       Line 1: 3 numbers, separated by blanks: 1)  systematic  drift  rate  in
       seconds per day, floating point decimal; 2) Resulting number of seconds
       since 1969 UTC of most recent adjustment or calibration, decimal	 inte-
       ger; 3) zero (for compatibility with clock(8)) as a decimal integer.

       Line  2:	 1  number: Resulting number of seconds since 1969 UTC of most
       recent calibration.  Zero if there has been no calibration yet or it is
       known  that  any previous calibration is moot (for example, because the
       Hardware Clock has been found, since that calibration, not to contain a
       valid time).  This is a decimal integer.

       Line  3:	 "UTC" or "LOCAL".  Tells whether the Hardware Clock is set to
       Coordinated Universal Time or local time.  You can always override this
       value with options on the hwclock command line.

       You  can use an adjtime file that was previously used with the clock(8)
       program with hwclock.



Automatic Hardware Clock Synchronization By the Kernel
       You should be aware of another way that the Hardware Clock is kept syn-
       chronized  in  some  systems.   The  Linux kernel has a mode wherein it
       copies the System Time to the Hardware Clock every 11 minutes.  This is
       a  good mode to use when you are using something sophisticated like ntp
       to keep your System Time synchronized. (ntp is a way to keep your  Sys-
       tem  Time synchronized either to a time server somewhere on the network
       or to a radio clock hooked up to your system.  See RFC 1305).

       This mode (we'll call it "11 minute mode") is off until something turns
       it  on.	 The  ntp daemon xntpd is one thing that turns it on.  You can
       turn it off by running anything, including hwclock --hctosys, that sets
       the System Time the old fashioned way.

       To see if it is on or off, use the command adjtimex --print and look at
       the value of "status".  If the "64" bit of this	number	(expressed  in
       binary) equal to 0, 11 minute mode is on.  Otherwise, it is off.

       If  your system runs with 11 minute mode on, don't use hwclock --adjust
       or hwclock --hctosys.  You'll just make a mess.	It  is	acceptable  to
       use a hwclock --hctosys at startup time to get a reasonable System Time
       until your system is able to set the  System  Time  from	 the  external
       source and start 11 minute mode.



ISA Hardware Clock Century value
       There  is  some sort of standard that defines CMOS memory Byte 50 on an
       ISA machine as an indicator of what century it is.   hwclock  does  not
       use  or set that byte because there are some machines that don't define
       the byte that way, and it really	 isn't	necessary  anyway,  since  the
       year-of-century does a good job of implying which century it is.

       If  you	have  a	 bona  fide  use  for a CMOS century byte, contact the
       hwclock maintainer; an option may be appropriate.

       Note that this section is only relevant when you are using the  "direct
       ISA"  method of accessing the Hardware Clock.  ACPI provides a standard
       way to access century values, when they are supported by the  hardware.


ENVIRONMENT VARIABLES
       TZ


FILES
       /etc/adjtime  /usr/share/zoneinfo/  (/usr/lib/zoneinfo  on old systems)
       /dev/rtc /dev/rtc0 /dev/port /dev/tty1 /proc/cpuinfo


SEE ALSO
       adjtimex(8),  date(1),  gettimeofday(2),	 settimeofday(2),  crontab(1),
       tzset(3)


AUTHORS
       Written	by  Bryan Henderson, September 1996 (bryanh@giraffe-data.com),
       based on work done on the clock program by Charles Hedrick, Rob	Hooft,
       and  Harald  Koenig.   See  the	source	code  for complete history and
       credits.


AVAILABILITY
       The hwclock command is part of the util-linux-ng package and is	avail-
       able from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.



				06 August 2008			    HWCLOCK(8)

 


www.eurower.info