There are two main clocks in a Linux system:
The Hardware Clock: This is a clock that runs independently of any control 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.
The System Time: This is the time kept by a clock inside the Linux kernel 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 seconds 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 initial-
ize 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 Hardware 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 (perhaps 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_minuteswest indicating how many minutes local time (not adjusted for DST) lags behind
UTC, and 2) a field tz_dsttime indicating the type of Daylight 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).)