%
% "@(#)sag:$Id$"
%

%--------------------------------------------------------------------
\chapter{Keeping Time} \label{chap:time}
%--------------------------------------------------------------------

        \begin{raggedleft}
        \it
	Time is an illusion.  Lunchtime double so. \\
	(Douglas Adams.) \\
        \end{raggedleft}
        \vspace{2em}

        \noindent
\meta This is just a few notes and a place holder

PC's have a battery powered clock, the CMOS clock.  It is independent
of the rest of the hardware.  The kernel maintains
its own notion of time, based on the timer interrupt.  The kernel clock
is initialized from the CMOS clock during boot, and runs then independently.

The CMOS clock can be queried with /sbin/clock.  That program can also
set the kernel time to that of the CMOS time, or vice versa.

The kernel maintains its clock in UTC (GMT).  The CMOS clock is usually
set to local time, because MS-DOS needs it to be local time.  If you're
only running Linux, then set the CMOS time to UTC.  /sbin/clock needs to
be told which it is (-u option), and, if in local time, what the time zone
is.

Time zones are maintained by user level code (i.e., each application itself)
in Linux.  The Linux C library uses N.N.'s time zone code and database,
stored in /usr/lib/zoneinfo.  You set the default time zone in the file
/usr/lib/zoneinfo/localtime.
Each process can set its time zone using the TZ environment variable, if
it does not want to use the default time zone.  The
Linux C library looks at it and reads the corresponding file in zoneinfo.

The zoneinfo databases can be used to adjust to daylight savings time as well.
If the CMOS clock is set to UTC, and the zoneinfo file is up to date,
the switches between normal time and dst are automatic.

The kernel clock should not be changed without care.  Many programs keep
internal time stamps, e.g., the X server, and if you set the time backwards,
they will get confused.

Small, systematic time changes can be done with adjtime.  It changes the
kernel clock slowly, so that the are no sudden jumps.
