268 lines
11 KiB
HTML
268 lines
11 KiB
HTML
<!--startcut ======================================================= -->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<html><head>
|
|
<META NAME="generator" CONTENT="lgazmail v1.1preB">
|
|
<TITLE>The Answer Guy 32:
|
|
The BIOS Clock, Y2K, Linux and Everything
|
|
</TITLE>
|
|
<!-- ORIGINAL SUBJECT:
|
|
linux, y2k and the system BIOS clock
|
|
JTD SUBTITLE:
|
|
|
|
-->
|
|
</head>
|
|
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#A000A0"
|
|
ALINK="#FF0000">
|
|
<H4>"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
|
</H4>
|
|
<P> <hr> <P>
|
|
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
|
<H1 align="center"><A NAME="answer">
|
|
<img src="../gx/dennis/qbubble.gif" alt="" border="0" align="middle">
|
|
<a href="./index.html">The Answer Guy</a>
|
|
<img src="../gx/dennis/bbubble.gif" alt="" border="0" align="middle">
|
|
</A></H1>
|
|
<BR>
|
|
<H4 align="center">By James T. Dennis,
|
|
<a href="mailto:linux-questions-only@ssc.com">linux-questions-only@ssc.com</a>
|
|
<BR>Starshine Technical Services, <A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
|
|
</H4>
|
|
<p><hr><p>
|
|
<!--endcut ========================================================= -->
|
|
<H3><img src="../gx/dennis/qbub.gif" alt="(?)"
|
|
width="50" height="28" align="left" border="0"
|
|
>The BIOS Clock, Y2K, Linux and Everything</H3>
|
|
<p><strong>From Ward, David on 12 Aug 1998 </strong></p>
|
|
<!-- begin body -->
|
|
|
|
<strong><p>How does linux keep track of "real time". Does it get its
|
|
information from the BIOS system clock, or can it keep track of time
|
|
by setting the correct time zone, and setting the time, even though
|
|
the BIOS is incorrectly reporting the "real time"?.
|
|
</p></strong>
|
|
<strong><p>Thanks,
|
|
<br>David Ward
|
|
</p></strong>
|
|
|
|
<blockquote><img src="../gx/dennis/bbub.gif" height="28" width="50"
|
|
alt="(!)" border="0"
|
|
>Linux's initial clock settings (at boot up) are from
|
|
the BIOS. However, the kernel internally keeps its
|
|
own time thereafter.
|
|
</blockquote>
|
|
<blockquote>It turns out that there is an immense about of work that
|
|
is done on system clock synchronization over the Internet
|
|
and among Unix systems.
|
|
</blockquote>
|
|
<blockquote>I'm assuming that you're concerned about some specific
|
|
systems that have a buggy BIOS --- that you know will
|
|
report invalid dates after the year 2000.
|
|
</blockquote>
|
|
<blockquote>To detect this condition you could use a script like:
|
|
</blockquote>
|
|
|
|
<blockquote><blockquote><code>CURRENT_YEAR=$( date +%Y )
|
|
<br>FILE_YEAR=$( find /etc/README -printf "%TY" )
|
|
|
|
<p>
|
|
<br>[ $CURRENT_YEAR -eq $FILE_YEAR ] || {
|
|
<br># We've suffered a backslip: the current 4 digit
|
|
<br># year arimetically precedes the date on our
|
|
<br># marker file
|
|
<br>logger "Backslip in Time Detected ... Fixing"
|
|
<br># Recover here....
|
|
<br># After recovery and during shutdown, when
|
|
<br># the clock is in a known good state, we can
|
|
<br># touch the marker file to unsure that it's
|
|
<br># date is periodically updated.
|
|
<br>}
|
|
</code></blockquote></blockquote>
|
|
|
|
<blockquote>... note that I'm using the <tt>$()</tt> (Korn/bash) construct
|
|
rather than the equivalent "backtick" operators. This is
|
|
to avoid ambiguity; the effect is the same.
|
|
</blockquote>
|
|
<blockquote>One way to ensure that you have the correct date set on
|
|
your system is to use the '<tt>ntpdate</tt>' command around boot
|
|
time. This sets your clock based on that of another
|
|
system. Oddly enough, though this command is included on
|
|
many Linux systems, there often seems to be no man page
|
|
installed for it. However I've read the man pages at
|
|
(<A HREF="http://www.eecis.udel.edu/~ntp"
|
|
>http://www.eecis.udel.edu/~ntp</A>) --- and they don't
|
|
make things any easier.
|
|
</blockquote>
|
|
<blockquote>With all due respect to Mr. Mills (one of the key figures
|
|
in the NTP system) these pages (man and web) look like they
|
|
were written for a federal funding grant. A simple HOWTO
|
|
would be nice. (Maybe I'm just stupid but these pages seem
|
|
to talk about everything <EM>other than</EM> how does a typical
|
|
home or SOHO sysadmin configure their systems to have the
|
|
correct time).
|
|
</blockquote>
|
|
<blockquote>In any event here's the command I use to initially set
|
|
my date:
|
|
</blockquote>
|
|
|
|
<blockquote><blockquote><code
|
|
>/usr/sbin/ntpdate -s ntp.ucsd.edu ns.scruz.net ntp1.cs.wisc.edu
|
|
</code></blockquote></blockquote>
|
|
|
|
<blockquote>... this calls the ntpdate command and lists three time
|
|
servers (stratum-2 in this case). In the complicated world
|
|
of NTP the "stratum" of a clock is a measure of how "far" it
|
|
is from the NIST atomic clocks which are used as the international
|
|
standards. In essense it is a measure of the time server's
|
|
"authority" (as in 'how authoritative is that answer'). It
|
|
isn't actually a measure of how "accurate" that clock is, just
|
|
how many hops are between it and the top of the hierarchy.
|
|
</blockquote>
|
|
<blockquote>Thus my system (betelgeuse) becomes a "stratum-3" NTP server
|
|
after I refer to these "stratum-2" servers. It is the system
|
|
that I use to set the time for the rest of the house. After
|
|
the time is initially set I periodically re-run this command
|
|
to reset it. It reports to me the adjustment that it makes
|
|
(typically under one second).
|
|
</blockquote>
|
|
<blockquote>This is <EM>NOT</EM> recommended practice.
|
|
(Mixing <tt>ntpdate</tt> and <tt>xntpd</tt>
|
|
on a system). However, in my case, I don't want to configure
|
|
my <tt>xntpd</tt> to refer to those same servers since it would mean
|
|
that my ISDN router would fire up an unnecessary connection to
|
|
the Internet every twenty minutes round the clock. Since I
|
|
have no easy way to prevent this (the ISDN router I'm using is
|
|
a separate box) I choose do use my method.
|
|
</blockquote>
|
|
<blockquote>If you have a full time connection to the Internet then the
|
|
best solution is to use the <tt>xntpd</tt> (extended Network Time
|
|
Protocol Daemon) to keep your system clocks in sync with a set
|
|
of time servers. I'd set up one or two systems on your
|
|
'perimeter' network (the one that's exposed to the Internet
|
|
--- assuming you have a firewall). Then I'd have the rest
|
|
of your systems use that (or those) as their time reference.
|
|
</blockquote>
|
|
<blockquote><tt>xntpd</tt> also includes support for a couple of dozen GPS and
|
|
radio clock devices. These range from a couple hundred
|
|
to a few thousand dollars (and typically connect to your
|
|
host via a serial line).
|
|
</blockquote>
|
|
<blockquote>In all cases <tt>ntpdate</tt> and <tt>xntpd</tt> use
|
|
sophisticated protocols to measure latency and network communications delays and
|
|
to account for deviations between the reference servers.
|
|
You're pretty well guaranteed sub-second accuracy when you use them.
|
|
</blockquote>
|
|
<blockquote>In some versions and configurations, the NTP suite supports
|
|
cryptographic integrity preservation methods, to prevent
|
|
spurious and hostiles changes to your network time references.
|
|
</blockquote>
|
|
<blockquote>The web pages I referred to above does have a wealth of
|
|
details about the protocols and the suite. If you can manage
|
|
to decode it into a set of simple instructions for us
|
|
"tape apes" I'd love to see it written up as a HOW-TO.
|
|
Perhaps the subscribers to the
|
|
<a href="news://comp.protocols.time.ntp">comp.protocols.time.ntp</a>
|
|
newsgroup might be more helpful.
|
|
</blockquote>
|
|
<blockquote>(My e-mail exchange with Mr. Mills on this issue was not
|
|
terribly helpful).
|
|
</blockquote>
|
|
<blockquote>There is one existing mini-HOWTO that could be expanded
|
|
to suit the bill:
|
|
</blockquote>
|
|
<blockquote>
|
|
<dl><dt>Clock Mini-HOWTO:
|
|
<dd><A HREF="http://www.ssc.com/linux/LDP/HOWTO/mini/Clock.html"
|
|
>http://www.ssc.com/linux/LDP/HOWTO/mini/Clock.html</A>
|
|
(written by Roy Bean).
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<blockquote>... it only contains a few words about <tt>xntpd</tt>.
|
|
</blockquote>
|
|
<blockquote>Also, someone once told me about a GPS reciever that was
|
|
very inexpensive. It had no display, only a DB-9 serial
|
|
connector. If anyone out there knows of a reliable source
|
|
for these, I'd like to know about it, and I'll be happy to
|
|
publish the URL. I wouldn't mind paying $100 for a good
|
|
time source --- but two or three hundred is just too much
|
|
for my applications.
|
|
</blockquote>
|
|
<!-- end body -->
|
|
|
|
<!--startcut ======================================================= -->
|
|
<P> <hr> <P>
|
|
<H5 align="center"><a href="http://www.linuxgazette.com/copying.html"
|
|
>Copyright ©</a> 1998, James T. Dennis <BR>
|
|
Published in <I>Linux Gazette</I> Issue 32 September 1998</H5>
|
|
<P> <hr> <P>
|
|
|
|
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::-->
|
|
<table width="98%"><tr valign="center" align="center">
|
|
<td rowspan="3"><A HREF="./lg_answer32.html"><IMG
|
|
SRC="../gx/dennis/answernew.gif"
|
|
ALT="[ Answer Guy Index ]"></A></td>
|
|
<td><A HREF="tag_phreak.html">phreak</A>
|
|
<td><A HREF="tag_abandon.html">abandon</A>
|
|
<td><A HREF="tag_javaterm.html">javaterm</A>
|
|
<td><A HREF="tag_BBS.html">BBS</A>
|
|
<td><A HREF="tag_flaws.html">flaws</A>
|
|
<td><A HREF="tag_doslinux.html">doslinux</A>
|
|
<td><A HREF="tag_resume.html">resume</A>
|
|
|
|
</tr><tr valign="center" align="center">
|
|
<td><A HREF="tag_softwindows.html">softwindows</A>
|
|
<td><A HREF="tag_convert.html">convert</A>
|
|
<td><A HREF="tag_apache.html">apache</A>
|
|
<td><A HREF="tag_emulate.html">emulate</A>
|
|
<td><A HREF="tag_database.html">database</A>
|
|
<td><A HREF="tag_distrib.html">distrib</A>
|
|
<td><A HREF="tag_proxy.html">proxy</A>
|
|
|
|
</tr><tr valign="center" align="center">
|
|
<td><A HREF="tag_disable.html">disable</A>
|
|
<td><A HREF="tag_DVI.html">DVI</A>
|
|
<td><A HREF="tag_superblock.html">superblock</A>
|
|
<td><A HREF="tag_serial.html">serial</A>
|
|
<td><A HREF="tag_permission.html">permission</A>
|
|
<td><A HREF="tag_detach.html">detach</A>
|
|
<td><A HREF="tag_cdr.html">cdr</A>
|
|
|
|
</tr><tr valign="center" align="center">
|
|
<td><A HREF="tag_rs422.html">rs422</A>
|
|
<td><A HREF="tag_modem.html">modem</A>
|
|
<td><A HREF="tag_notfound.html">notfound</A>
|
|
<td><A HREF="tag_tuning.html">tuning</A>
|
|
<td><A HREF="tag_libc5.html">libc5</A>
|
|
<td><A HREF="tag_startup.html">startup</A>
|
|
<td><A HREF="tag_clock.html">clock</A>
|
|
<td><A HREF="tag_ping.html">ping</A>
|
|
|
|
</tr><tr valign="center" align="center">
|
|
<td><A HREF="tag_accounts.html">accounts</A>
|
|
<td><A HREF="tag_lilo.html">lilo</A>
|
|
<td><A HREF="tag_NDS.html">NDS</A>
|
|
<td><A HREF="tag_95slow.html">95slow</A>
|
|
<td><A HREF="tag_nonlinux.html">nonlinux</A>
|
|
<td><A HREF="tag_progenv.html">progenv</A>
|
|
<td><A HREF="tag_cluster.html">cluster</A>
|
|
<td><A HREF="tag_ftpd.html">ftpd</A>
|
|
|
|
</tr></table>
|
|
<P> <hr> <P>
|
|
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::-->
|
|
<A HREF="./index.html"><IMG SRC="../gx/indexnew.gif"
|
|
ALT="[ Table Of Contents ]"></A>
|
|
<A HREF="../index.html"><IMG SRC="../gx/homenew.gif"
|
|
ALT="[ Front Page ]"></A>
|
|
<A HREF="lg_bytes32.html"><IMG SRC="../gx/back2.gif"
|
|
ALT="[ Previous Section ]"></A>
|
|
<A HREF="./stemen.html"><IMG SRC="../gx/fwd.gif"
|
|
ALT="[ Next Section ]"></A>
|
|
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::-->
|
|
</body>
|
|
</html>
|
|
<!--endcut ========================================================= -->
|
|
|
|
|